Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: Why SUID Binary exploit does not yield root shell?

From: Brian Hatch <vuln-dev(at)ifokr.org>
Date: Sun Mar 09 2003 - 10:49:08 EST

> I've managed to find a buffer overflow and exploit it to exeve a /bin/sh

Some /bin/sh's will drop privs if uid != euid. Bash is one of these. Instead of using /bin/sh during your test, try /usr/bin/id just to see what uid and euid are. If euid is root yet /bin/sh is not yielding root, that's the cause. You can always compile your own sh frontend to fix uid too:

...
main () {

	setuid(0); seteuid(0); setgid(0);
	execve("/bin/sh",...)

}

Compile, install, and call that instead. You should probably just include setuid(0) instructions into your shellcode to avoid the middle man. Or you could call /bin/csh which usually doesn't drop privs (but leaves folks stuck in the unpleasant world of C shell) or any pretty much other shell-like program.

> What is the magic here (if any)?

Bash is being "smarter" than you want it to be.

--
Brian Hatch                  Is a book on
   Systems and                voyeurism a
   Security Engineer          peeping tome.
http://www.ifokr.org/bri/

Every message PGP signed

  • application/pgp-signature attachment: stored
Received on Sun Mar 9 16:45:41 2003
Do you need help?X

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:07:38 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library