5 ms·
Whatever. One can always write unsafe code. No matter in what language. A really secure language is almost worthless because there's so much it can't do. No, t
by marcosdumay 12y ago
Whatever. One can always write unsafe code. No matter in what language. A really secure language is almost worthless because there's so much it can't do.
No, the problem comes from the other end. Strings should not be able to compromise a system. It only needs to read a user supplied file, and write to stdout. There's no reason for it to be allowed to exec a piece of code.
- meowface 12y agoMultiple factors are to blame. I agree this is dumb behavior here by strings, but if the ELF parsing code were to be written in a language like Rust, it's far less likely it would have a bug of this nature.
- thirsteh 12y agoRust... or pretty much any other language than C. C is scary from a security perspective because it is both incredibly easy to write code that has subtle but very serious bugs leading to e.g. arbitrary code execution, and it is easy to exploit those vulnerabilities.
- maccard 12y agoSo what you're saying is that the bugs from a piece of software written 20 years ago (roughly) can be solved by writing the program in a language that hasn't had a stable release yet? Sure there are better alternatives now, but what widespread, well known, portable language was available in the mid 90's that this could have been written in?
- thirsteh 12y agoYou seem to be arguing against yourself. If 'strings' were written in a safe language, compromising the system would be extremely unlikely. Or are you seriously arguing that languages that are safer than C aren't Turing complete? There are plenty of memory-safe languages in which you can do nearly everything you'd do in C, and much, much safer. There's no reason whatsoever a program like 'strings' couldn't be written in a memory-safe language.
- AnthonyMouse 12y ago> If 'strings' were written in a safe language, compromising the system would be extremely unlikely. Shellshock was a parsing bug, the memory safety of bash helped nothing. Bugs are bugs. When you get an out of bounds exception that leaves your program in an inconsistent state somewhere halfway up the call stack in a code path with poor test coverage, "safe" is not the correct word.
- thirsteh 12y agoThe premise of this conversation is flawed: A language isn't "insecure" or "secure." It's placed at a certain point in a safety spectrum ranging from "Do anything with no safety" to "Safely heat the room and achieve nothing." What I'm saying is not that you can't write software that can be abused in memory-safe languages. I'm saying that you're much less likely to have extremely serious code execution vulnerabilities if you write a program in Go instead of C.
- AnthonyMouse 12y ago> What I'm saying is not that you can't write software that can be abused in memory-safe languages. I'm saying that you're much less likely to have extremely serious code execution vulnerabilities if you write a program in Go instead of C. What I'm saying is that "much" less likely is overstating the difference. Most bugs in C programs are not buffer overruns, and even the ones that are would still be bugs in Go or Rust, they would just be a different kind of bug which is still plausibly exploitable under real conditions. This is not a silver bullet kind of situation. "Rewrite everything in Go" is not actually a fix -- it's replacing code with 30 years worth of bug reports and vulnerability testing with completely untested new code, at the cost of significant resources that could better be used to fix the remaining vulnerabilities. I'm not even saying that all the existing code is perfect. Replacing OpenSSL with entirely new code would probably do more good than harm just because the existing code is so ugly. But that's the exception rather than the rule.
- thirsteh 12y ago
- twoodfin 12y agoDespite the volume of messages on this thread about securing C or replacing it with a safer language for systems implementation, I think your answer is the only practical one. If you haven't seen it already, you might want to check out HiStar: http://www.scs.stanford.edu/histar/ http://www.scs.stanford.edu/histar/
- Confusion 12y agoIt's not 'allowed' to exec a piece of code. It parses code and the parser contains a bug that can be exploited to execute code. Code that is unsafe in this way is impossible to write in most languages.