r/ProgrammerHumor • • Oct 22 '26

instanceof Trend itsBadIfItsOnlyPHP

Post image
4.5k Upvotes

335 comments sorted by

View all comments

242

u/pjank85 Oct 22 '26

Java had the famous logging one, JavaScript had uncountable ones, but did Rust ever had a high profile RCE?

269

u/SelfDistinction Oct 22 '26

Aside from supply chain attacks when a library developer's credentials got stolen, all of the Rust CVEs so far have been "this function accidentally allows you to cause a segfault in a nonexisting edge case if you really tried to make it not work."

The latest one makes it so that references' lifetime can be extended past the referee's lifetime if a destructor copies it to a global variable but since no one writes that kind of spaghetti it went unnoticed for 11 years.

45

u/TRKlausss Oct 22 '26

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 Oct 22 '26

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 Oct 22 '26

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

8

u/Loading_M_ Oct 22 '26

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

17

u/Ecksters Oct 22 '26

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".

→ More replies (2)

41

u/Spinnenente Oct 22 '26

Logging just affected A library not the base language.

20

u/pjank85 Oct 22 '26

To be fair if something like this affected ex. Boost no sane C++ dev would claim it was just a library. Log4j was not a library it was THE library for Java logging. If a library is very widely used whenever it is in the standard library or not is almost irrelevant.

→ More replies (1)

14

u/pringlesaremyfav Oct 22 '26

There were just 2 main logging libraries, log4j was nearly universal across Java

2

u/Spinnenente Oct 22 '26

only log4j2 was affected anyone using log4j wasn't

→ More replies (2)

10

u/DXPower Oct 22 '26

I'm confident it will eventually, just given the law of large numbers and the baseline bug rate of all written code. All it takes is for a big library to use a small bit of unsafe incorrectly, a bug in the compiler that drops a check (this actually happened recently), a DLL that does something unexpected / undocumented, etc.

One thing to remember is that the PHP issue wasn't in the language, it was in the VM/runtime implementation. That implies that no matter how safe the language is from a design perspective, it can still cause issues due to how it interacts with the OS and hardware. Rust has been implemented for VMs such as WebASM. That means all that's remaining is some exploit in the WASM runtime, and a Rust WASM library that generates code in such a manner to expose the vector.

14

u/Ok-Scheme-913 Oct 22 '26

Did Rust ever have a high profile backend usage to get into a situation to have one?

I mean, I do love rust but it's not primarily used as a typical web backend language to be in a position of "high target" and "connected to every other machine over the internet".

29

u/TRKlausss Oct 22 '26 edited Oct 22 '26

Oh yes definitely! Rust is used in servers by Oxide computing, in cars by Volvo Cars, and a bunch of other infrastructure like parts of Cloudflare (which has a really nice post-mortem on some Rust code causing them problems, which was due to business logic and not the language itself).

Check out Rust In Production podcast if you want to hear some real-life stories about Rust out there in the world :)

Edit: ah and forgot to mention: it is a certified safety-critical language for industrial and automotive applications thanks to Ferrocene. So I’d say that’s high profile _enough_

https://www.reddit.com/r/rust/s/Zt7xKT56gm

3

u/ConnaitLesRisques Oct 22 '26

Oxide isn’t exactly mainstream or high profile.

7

u/thirdegree Violet security clearance Oct 22 '26

What about Cloudflare?

4

u/ConnaitLesRisques Oct 22 '26

I’ll allow it, they’re a promising little startup.

3

u/Ok-Scheme-913 Oct 22 '26

Sure, it's cool and whatnot. Still, it's not used by people who don't know shit about IT to host their websites on a good chunk of the internet.

Also, at cloudflare I believe they are operating on a lower level (so not necessarily (de)serializing arbitrary data from unknown people), and I don't see how your Volvo would be similar to a web server.

Languages have their use cases and while rust can be used for traditional backend, it's not its primary use case, and it's significantly smaller than PHP or java.

→ More replies (11)

2

u/meneldal2 Oct 22 '26

Wouldn't Firefox be a pretty big attack target for Rust?

→ More replies (3)

3

u/postexitus Oct 22 '26

Oh, yeah same argument I used for Amiga not having viruses. Yay!

3

u/Loading_M_ Oct 22 '26

More than 50% of new code in Android is Rust. Being the most popular phone OS world wide, I think that would make it a huge target.

→ More replies (1)

1

u/redlaWw Oct 22 '26

One of the big advantages of Rust is how easily it fits into existing backends since it can be called using C ffi. There aren't many pure-Rust backends, but more and more backends are using some Rust, starting with some of the more high-profile companies.

→ More replies (2)
→ More replies (1)

6

u/notAGreatIdeaForName Oct 22 '26

The question is: Has it had one YET

1

u/DatBoi_BP Oct 22 '26

No but RustScript did

→ More replies (6)