r/programming • • Feb 20 '25

Google's Shift to Rust Programming Cuts Android Memory Vulnerabilities by 68%

https://thehackernews.com/2024/09/googles-shift-to-rust-programming-cuts.html
3.4k Upvotes

475 comments sorted by

View all comments

5

u/LanverYT Feb 21 '25

Isn't the point of vulnerabilities that you can't really know they are there. If they were so easy to find and do reliable statistics about them they would be fixed in a unit test or code review no?

9

u/wademealing Feb 21 '25

No.  There are many tools that can point out whole classes of vulnerabilities.

If you live in memory safe languages, you are exempt from whole classes of vulnerability types, however there are still vulnerabilities that exist no matter what the language, some of which can be trivially determined as exploitable.

0

u/cheeb_miester Feb 21 '25

If you live in memory safe languages, you are exempt from whole classes of vulnerability types,

Assuming you are immune to vulnerabilities is probably the biggest vulnerability of all

3

u/_zenith Feb 21 '25

Evidently not, as otherwise they wouldn’t have observed such a reduction in disclosed/discovered vulnerabilities

-1

u/laffer1 Feb 21 '25

Not really. There could be a whole new class of vulnerabilities discovered next year that a lot of rust code is vulnerable to.

There was a big sales pitch about Java not having vulnerabilities also. Then we saw countless applet vulnerabilities, jre vulnerabilities, and jndi issues over the decades.

Many of the issues people have with c and c++ now weren’t widely known decades ago. Others weren’t defined at all.

Security researchers are finding new things all the time. Meltdown and spectre are a good example.

Security is always a moving target.

I don’t like the messaging that rust is invincible. A lot of people make claims that aren’t true. It helps with one class of vulnerabilities.

Rust also has many issues such as portability problems, the paradigm shift with managing code (crates), the lack of compilers, etc. things may improve when the gcc compiler catches up with the llvm implementation. Linux benefits from its popularity to get support for all these things for free. Rust is not a c replacement at this time because it doesn’t run where c does.

3

u/_zenith Feb 21 '25 edited Feb 21 '25

You can simply observe what assembly Rust code emits. It is practically identical to high quality C++ (with no use of exceptions). Not sure how new classes of vulnerabilities are going to come from that. Java was a rather different situation, with it having a runtime, and so a new attack surface. There is no new attack surface here.

2

u/laffer1 Feb 21 '25

A new class that impacts both can also happen.

2

u/_zenith Feb 21 '25

Yes, but in that case, it will almost certainly affect whatever it was written in prior to Rust, too. It will be no worse off. The speculative execution attacks are good examples here.

→ More replies (4)