Stack-Smashing Protector
XNormal writes "It's not exactly new but for some reason it doesn't seem to be getting the attention it deserves. The stack smashing-protector developed by Hiroaki Etoh at IBM's Tokyo Research Lab is a patch for GCC that provides effective protection against buffer overflows. It protects against cases not covered by StackGuard and StackShield.
It it well-supported on multiple versions of GCC and multiple platforms. Why is it not getting enough attention? Perhaps it needs a CatchyName instead of 'ssp'? I'll ponder this question while I'm recompiling all my executables that have an open port and the libraries they depend on."
How does this compare to OpenBSD's new non-executable stack? I am confused by how this works, and also how a non-executable stack works. I would appreciate it if someone could explain this in laymans terms.
The
On functions subject to buffer overrun problems, the compiler will allocate space on the stack before the return address. On function entry, the allocated space is loaded with a security cookie that is computed once at module load. Then, on function exit, a compiler helper is called to make sure the cookie's value is still the same. If the value is not the same, an overwrite of the return address has potentially occurred, and so an error will be reported and the process (or at least the thread) terminated.
cpeterso
When I saw the headline, for some reason I read "Smashing Pocket Protector". I was beginning to think that this really is "News for nerds". :P
It seems like it would be difficult to get a whole lot of developers to move over to this at once, so perhaps that's why it's not catching on? If one major group of developers (Red Hat, Debian, whoever) started using this patch, perhaps their influence could sway others? It's not like the world of M$ where the necessary constant upgrading forces users to switch to technologies that Microsoft thinks are important. (Although buffere overflows are a very important issue, I'm just commenting on the fact that it's Microsoft that pushes the technologies, not the needs of the developers.)
Learn to Play Go
The reason stack protection stuff isn't being widely used isn't because it's got an obscure name or something simple like that. It's because not everyone can agree whether it's effective or just lures people into a false sense of security. There have been a couple of "discussions" of this on the Linux Kernel Mailing List and the end result is always a stalemate.
dan
It was thought to be the most efficient way to implement some C++ constructs (I don't remember which).
Some other (Lisp?) compilers use similar tricks.
It is much easier to convince someone to use a specific flag, than to install a third party patch. The later takes more time, and require you to trust more people.
Loading of dynamically-linked library should be handled by the kernel not the application.
The kernel should provide the architecture so that the application never has to do any of this stuff, all relocation etc... should be handled by the kernel and not the application.
If the kernel does all of this then you can say that the operating system is secure to buffer overrun exploits, the apps will still crash though and could be comprimised in other ways.
Ring 0(should only be the kernel) can change the W+R+X of a memory address if it want's to.
thank God the internet isn't a human right.
So what you mean is that /GS behaves the way StackGuard does. (calling the cookie a canary is not a practice Microsoft initiated).
If you read the phrack article linked to in the story, they discuss situations where this manner of buffer overrun protection is insufficient. True, most exploits out there today do use straight overruns onto the return address, but that's only because they can.
That being said, I imagine that the conditions described in the phrack article for getting a manipulable pointer are less common than the authors would like to think.
I don't know if GCC generates code on the stack for C++ constructs. It does that for pointers to nested functions though. For example:
g needs the address of the stack frame of f in order to access a. If f called g directly, it would pass the address as a hidden parameter. The problem is, call does not know about the extra parameter. GCC solves this by making the function pointer p point to a trampoline that loads the correct address in a register and jumps to the real g. f generates this trampoline on the stack at runtime, so it is reentrant.
The Hurd uses lots of nested functions.
Prevent applictaions proccess from running in memory ranges they havn't requested privilage for.
If you can't write directly into the application, and you can't redirect the application to execute outside it's requested space. Then it becomes very difficult to get those m$ type exploits.
I think Microsoft is doing something like this with paladium? (I only said like mind you!)
The kernel is responsible for loading executables
You can request access mode change for a page of memory from the kernel.
The Kernel won't permit the applications EIP be in pages that the application hasn't requested access for.
when you malloc you request your access mode.
This kinde of model also helps threading,because the kernel knows where self modifying code is, where read-only pages are etc... and can make far better use of caches and page flushes between threads.
thank God the internet isn't a human right.