[PATCH] Unbound alloca in crypt routines

Jeff Law law@redhat.com
Thu Mar 29 16:56:00 GMT 2012


md5-crypt, sha256-crypt and sha512-crypt have unbounded alloca uses.  If 
passed a sufficiently long key, they can blow out the stack causing a 
segfault in the current thread.

More problematical is a long, malicious key could be used to corrupt 
another thread's stack or shift the stack pointer into the heap as a 
vector for an attack.  I'm not currently aware of any such exploits in 
the wild.

md5-crypt has just one such alloca when it detects an unaligned key. 
The length of the salt is suitably limited, so it's not a problem.  This 
patch falls back to malloc if the key is too long.

sha256-crypt and sha512-crypt have multiple unbounded alloca uses 
related to the length of the key.  They are fixed by falling back to 
malloc if the key is too long.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: glibc-rh804792.patch
Type: text/x-patch
Size: 7703 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120329/8f698172/attachment.bin>


More information about the Libc-alpha mailing list