5 ms·
This effectively treats libc as a trusted interface. Checking should be at the protection boundary, the system call. This just makes attacks more complicated, n
by Animats 7y ago
This effectively treats libc as a trusted interface. Checking should be at the protection boundary, the system call. This just makes attacks more complicated, not less successful.
- miohtama 7y agoIn a long run the non-complicated solution is to get rid of anything that can compile to something with a buffer overflow. Just half trolling.
- jacquesm 7y agoThere goes Rust I guess...
- pjmlp 7y agoI doubt we will ever see a UNIX clone written in Rust. An OS that happens to expose some support for POSIX, yeah (e.g. Redox), but anything else wouldn't be an UNIX clone per se.
- clarry 7y agoAnd that's all good, we don't need more people cloning an OS that was good 50 years ago. Modern software is sidestepping the UNIX way left and right. Rightly so, as anyone who's tried to write anything serious in shell would know. Or anyone who realizes that non-blocking I/O was an afterthought (look into the history of select(2) and why libraries like libev exist and what problems they run into on unix derivatives..) and that there's still nothing like a standard, robust, well designed async I/O API.
- pjmlp 7y agoUNIX was good, for an OS given away with source code and an almost free license (versus what other mainframe OS were asking for). History would be quite different if AT&T was allowed to sell it from day one.
- deleted 7y ago[deleted]
- alexgartrell 7y agoIf you can change libc then you have equal to or greater permissions than the calling process. So this strengthens the security model.
- jacquesm 7y agoDoes that mean that linking against libc is mandatory and that applications are not allowed to bring their own version of libc along for instance when linked statically?
- saagarjha 7y agoStatically linked programs automatically lose this protection, apparently.
- ori_b 7y agoPartly. If they jit, or have shellcode injected, that code is not mappable with syscall privilege.
- tedunangst 7y agoNo. There's nothing special about libc. (Oh, double checked, and uh, maybe. ld.so does treat libc specially if it finds it in the library list, but at that point, you are linking with libc. But afaik there's no requirement you use the system ld.so either.)
- jacquesm 7y agoThen isn't Animats' point valid?
- tedunangst 7y agoThe point of doing this is not to protect against people bringing their own bad libc.
- 7y ago
- vlovich123 7y agoYes it’s more complicated but that’s how all security works and why security exploits are more expensive today than before. The reason this defense requires libc is because syscalls are not a function calls (you push args onto the stack and then trigger a software interrupt). This defense technique is both simple (in terms of relative change from how things work today) and effective in that buffer overflows can’t ever call into the kernel but now instead have to go through libc which has had its location randomized on the application launch. To provide this protection at the syscall layer would require some kind of randomization of how a syscall is performed which is something that has no prior art since that’s just pushing arguments into the stack and triggering an interrupt through a single instruction meaning complexity of the work is unknown in terms of how to secure a buffer overflow from being able to do that (ie harden an arbitrary process to not be able to directly jump into a syscall). Additionally because there’s no prior art the scope of that kind of change wouldn’t have the benefit of having well-understood behavior. Not impossible or prohibitive but raises the bar for the benefit you’d have to provide (& probably get a chip manufacturer and compiler vendors to go along with you). Also even if you could 3rd party binaries wouldn’t gain that protection magically. Putting this in libc is fantastic. Arguably Linux’s decision to treat libc as an external unrelated project and keep ABI comparability at the syscall layer prevents a protection mechanism like this.
- Animats 7y agoYes it’s more complicated but that’s how all security works and why security exploits are more expensive today than before. That's how security theater for software works. Today's attackers are well-funded and technically competent. This is a a defense against script kiddies. The way to get rid of buffer overflows is to get rid of C in trusted code, not requiring users to go through libc. It isn't hard any more. We have Go, Rust, C#, Java, and even node.js and Python for server side. If you're running C in a user-facing server application, you're doing it wrong.
- saagarjha 7y agoI hope you're not suggesting that modern mitigations such as W^X and ASLR are "security theater" :/
- saagarjha 7y ago> Checking should be at the protection boundary, the system call. This doesn’t make sense, though. This would mean the OS would need to know the control flow of the program itself to figure out whether it “should” allow a system call to proceed.