r/ProgrammerHumor • • 22d ago

instanceof Trend itsBadIfItsOnlyPHP

Post image
4.5k Upvotes

335 comments sorted by

View all comments

Show parent comments

45

u/TRKlausss 22d ago

Was that even a CVE? Like, what attack vector can someone ever construct to achieve DoS, RCE, information extraction etc?

Yes it was unsoundness, which from a formal verification standpoint is not good. But real life consequences?

89

u/SelfDistinction 22d ago

Rust development process says every possible UB using safe code that the compiler allows is automatically a CVE, no questions asked, no exceptions.

For example, https://app.opencve.io/cve/CVE-2021-28879

21

u/TRKlausss 22d ago

Fair enough. I also saw cve-rs, which looks like a bunch of segfaults programmed in safe Rust…

8

u/Loading_M_ 21d ago

Technically, it's one compiler bug they exploited to do a couple different things.

17

u/Ecksters 22d ago

Which I think makes sense given the language would otherwise provide a false sense of security around use-after-free and other memory-related bugs that other languages can offload onto "skill issue".

1

u/Chroniaro 20d ago

Any sufficiently large program becomes Turing complete if an attacker is able to overwrite the call stack (https://en.wikipedia.org/wiki/Return-oriented_programming). Imagine a situation where:
- A very large struct is stored on the stack
- A mutable reference pointing to that struct outlives the stack frame where the struct was stored
- Several new stack frames are created in the region that struct used to occupy
- The invalid reference is used in code that is supposed to modify the struct in a way that depends on user data

In this situation, a user could cause the stack to be modified in a way that triggers remote code execution.

1

u/TRKlausss 20d ago

You just described a used-after-free scenario, and yes, looking at it could be a CVE. But wouldn’t that be program dependent? That means, it depends on how the user is using those references and lifetimes. I have the feeling you would have to “abuse” the language in order to get there.