Thanks for proving Bernstein right
Thanks for proving Bernstein right
Posted Nov 4, 2007 17:54 UTC (Sun) by i3839 (guest, #31386)In reply to: Thanks for proving Bernstein right by jordanb
Parent article: Daniel Bernstein: ten years of qmail security
Yes, it certainly has. But more or less all of those can be summarized by "altering the return address", often in combination with injecting malicious instructions. Compiling programs with -fstack-protection helps against that, as does random address layout and non-executable stacks/heaps. So the problem looks worse than it is, because e.g. every buffer overflow is flagged as a security breach, while in practice it might be near impossible to actually exploit it. You might also be interested in the -fmudflap option, but I don't know anything about it. Same for -ftrapv which causes the program to abort when a signed integer overflows. I tried it, and it works, but not when optimization is enabled. :-/ And those lowlevel errors distract from the higher level security problems in applications, which are more often than not language independent. It's incredible how many unsafe temp file handling bugs are still found, to name one thing. It's true that many libc functions aren't very security friendly (e.g. strncat), but by now people should know that and use the safer alternatives. The compiler could do much more compiletime checking too, and there are some options to enable checking a few things, but more could be done. For runtime checking Valgrind is great. The weak typing of C isn't as big a problem as it could be thanks to compiler warnings. Only thing I use a debugger for is to get backtraces. And the reason you need a debugger for that in C and not in some others is because in interpreted languages the backtrace is generated by the virtual machine. I really hate PHP, let's not go near there. Any language where mistyping a variable name causes weird buggy behaviour instead of a (compiletime) error is not worth existing. Weak typing combined with automatic variable declaration/memory handling is just a nightmare.
