10 ms·
> I'm glad that I'm working in a time where I can build all of my parsers and attack surface in Rust and just think way, way less about this. I'm beginning to
by cratermoon 5y ago
> I'm glad that I'm working in a time where I can build all of my parsers and attack surface in Rust and just think way, way less about this.
I'm beginning to worry that every time Rust is mentioned as a solution for every memory-unsafe operation we're moving towards an irrational exuberance about how much value that safety really has over time. Maybe let's not jump too enthusiastically onto that bandwagon.
- Ar-Curunir 5y ago… it is a solution for every memory-unsafe operation, though?
- choeger 5y agoNo. Rust cannot magically avoid memory-unsafe operations when you have to deal with, well, memory. If I throw a byte stream at you and tell you it is formatted like so and so, you have to work with memory and you will create memory bugs. It can however make it extremely difficult to exploit and it can make such use cases very esoteric (and easier to implement correctly).
- Ar-Curunir 5y agoThat's not memory-unsafety. Memory-safety means avoiding bugs like buffer overflow, ROP, etc.
- UncleMeat 5y agoThat's totally untrue, unless you are using a really weird definition of "memory safety". A rust program that doesn't make use of the unsafe keyword will not have memory safety bugs. We've had programming languages for decades that are able to happily process arbitrary bytestreams with incredibly buggy code without ever actually writing to a memory region not reachable through pointers allocated by the ordinary program execution. A Java program can't write over the return address on the stack.
- bogomipz 5y ago>"A Java program can't write over the return address on the stack." Could you say why Java is not susceptible to ROP?
- UncleMeat 5y agoROP isn't the vulnerability, but instead the exploitation technique. "Memory safety errors" were around for decades before ROP was widely understood. A Java program, by construction, cannot write to memory regions not allocated on the stack or pointed to by a field of an object constructed with "new". Runtime checks prevent ordinary sorts of problems and a careful memory model prevents fun with concurrency errors. There are interesting attacks against the Java Security Manager - but this is independent of memory safety.
- bogomipz 5y agoYes I'm well aware of buffer overflows/stack smashing. I was asking why Java wasn't susceptible to something like ROP.
- UncleMeat 5y agoAll memory access in Java goes through fields or array offsets. There are runtime checks around class structure that ensure that a field load cannot actually read some unexpected portion of memory. There are runtime checks that ensure that you cannot read through a field on a deallocated object, even when using weakreference and therefore triggering a GC even while the program has access to that field. There are runtime checks around array reads that ensure that you cannot access memory outside of the allocated bounds of the array. I have no idea why "susceptible to something like ROP" is especially relevant here. ROP is not the same as "writing over the return address" ROP is a technique you use to get around non-executable data sections and happens after you abuse some memory safety error to write over the return address (or otherwise control a jump). It means "constructing an exploit via repeated jumps to already existing code rather than jumping into code written by the attacker". But just for the record, Java does have security monitoring of the call stack that can ensure that you cannot return to a function that isn't on the call stack so even if you could change the return target the runtime can still detect this.
- ddalcino 5y agoWhat’s with the backlash against Rust? It literally is “just another language”. It’s not the best tool for every job, but it happens to be exceptionally good at this kind of problem. Don’t you think it’s a good thing to use the right tool for the job?
- cratermoon 5y ago> What’s with the backlash against Rust? What's with the hyping of Rust as the Holy Grail as the solution to everything not including P=NP and The Halting Problem?
- pdimitar 5y agoNo serious and good programmer is hyping Rust as the "Holy Grail". You are seeing things due to an obvious negative bias. Link me 100x HN comments proving your point if you like but they still mean nothing. I've worked with Rust devs for a few years and all were extremely grounded and practical people who arrived at working with it after a thorough analysis of the merits of a number of technologies. No evangelizing to be found. Most security bugs/holes have been related to buffer [over|under]flows. Statistically speaking, it makes sense to use a language that eliminates those bugs by the mere virtue of the program compiling. Do you disagree with that?
- tptacek 5y agoNobody seriously thinks it's "Rust" that's the silver bullet either; they just believe memory-safe languages are. There are a bunch of them to choose from. We hear about Rust because it works in a bunch of high-profile cases that other languages have problems with, but there's no reason the entire iMessage stack couldn't have been written in Swift.
- pdimitar 5y agoAgreed. I was simply mostly addressing this person's obvious beef with Rust.
- 5y ago
- colonelxc 5y agoThe article we are commenting on is about targeted no-interaction exploitation of tens of thousands of high profile devices. I think this is one of the areas where there is a very clear safety value (not just theoretical).
- staticassertion 5y agoI'm a security professional so it's based on being an experienced expert, not some sort of hype or misplaced enthusiasm.
- bitwize 5y agoWhole classes of bugs -- the most common class of security-related bugs in C-family languages -- just go away in safe Rust with few to no drawbacks. What's irrational about the exuberance here? Rust is a massive improvement over the status quo we can't afford not to take advantage of.
- TaupeRanger 5y agoThere's literally zero evidence that a program written in Rust is actually practically safer than one written in C at the same scale. And there won't be any evidence of this for some time because no Rust program is as widely deployed as an equivalent highly used C program.
- rrdharan 5y agoI’d wager Dropbox’s Magic Pocket is up there with equivalent C/C++ based I/O / SAN stacks: https://dropbox.tech/infrastructure/extending-magic-pocket-innovation-with-the-first-petabyte-scale-smr-drive-deployment https://dropbox.tech/infrastructure/extending-magic-pocket-i...
- staticassertion 5y agoThat's not true, actually. There is more than "literally zero" evidence. I don't feel like finding it for you, but at minimum Mozilla has published a case study showing that moving to Rust considerably reduced the memory safety issues they discovered. That's just one example, I believe there are others. There are likely many other examples of, say, Java not having memory safety issues. Java makes very similar guarantees to Rust, so we can extrapolate, using common sense, that the findings roughly translate. Common sense is a really powerful tool for these sorts of conversations. "Proof" and "evidence" are complex things, and yet the world goes on with assumptions that turn out to hold quite well.
- TaupeRanger 5y agoNot sure what your last sentence means - without evidence, there are cases when we guess right, and those when we guess wrong. Are you just choosing to ignore the latter? The Mozilla case study is not a real world study. It simply looks at the types of bugs that existed and says "I promise these wouldn't have existed if we had used Rust". Would Rust have introduced new bugs? Would there be an additional cost to using Rust? We don't know and probably never will. What we care about is preventing real world damage. Does Rust prevent real world damage? We have no idea.
- 5y ago
- tialaramex 5y agoNot just memory safety. Rust also prevents data races in concurrent programs. And there are a few more things too. But these tricks have the same root: What if we used all this research academics have been writing about for decades, improvements to the State of the Art, ideas which exist in toy languages nobody uses -- but we actually industrialise them so we can use the resulting language for Firefox and Linux not just get a paper into a prestigious journal or conference? If ten years from now everybody is writing their low-level code in a memory safe new C++ epoch, or in Zig, that wouldn't astonish me at all. Rust is nice, I like Rust, lots of people like Rust, but there are other people who noticed this was a good idea and are doing it. The idea is much better than Rust is. If you can't do Rust but you can do this idea, you should. If ten years from now people are writing unsafe C and C++ like it's still somehow OK, that would be crazy. Imagine it's 1995, you have just seen an Internet streaming radio station demonstrated, using RealAudio. Is RealAudio the future? In 25 years will everybody be using RealAudio? No, it turns out they will not. But, is this all just stupid hype for nothing? Er no. In 25 years everybody will understand what an "Internet streaming radio station" would be, they just aren't using RealAudio, the actual technology they use might be MPEG audio layer III aka MP3 (which exists in 1995 but is little known) or it might be something else, they do not care.
- deckard1 5y ago> If ten years from now people are writing unsafe C and C++ like it's still somehow OK, that would be crazy. It's 26 years after Java was released. Java has largely been the main competitor to C++. I don't see C++ going away nor do I see C going away. And it's almost always a mistake to lump C and C++ developers together. There is rarely an intersection between the two. I think you do not understand how short 10 years is. There are tons of people still running computers on Sandy Bridge.
- tialaramex 5y ago> I think you do not understand how short 10 years is. There are tons of people still running computers on Sandy Bridge. Ten years is about the time since C++ 11. I may be wrong, but I do not regret my estimate.
- jvanderbot 5y agoLanguage absolutism.
- UncleMeat 5y ago> how much value that safety really has over time Billions and billions of dollars. Large organizations like Microsoft and Google have published numbers on the proportion of vulns in their software that are caused by memory errors. As you can imagine, a lot of effort is spent within these institutions to try to mitigate this risk (world class fuzzing, static analysis, and pentesting) yet vulns continue to persist. Rust is not the solution. Memory-safe languages are. It is just that there aren't many such languages that can compete with C++ when it comes to speed (Rust and Swift are the big ones) so Rust gets mentioned a lot to preempt the "but I gotta go fast" concerns.