On most modern Linux systems, /bin/sh is provided by bash, which detects that it’s being invoked as sh, and attempts to mimic traditional sh. As everyone who works in security quickly learns, bash will drop privileges very early if uid != euid.
Where disable_priv_mode is defined as:
A nice example of this failing can be observed in the VMware utilities, which try to invoke lsb_release with popen() to learn about the current execution environment. This means you can get a nice easy root shell like this on any Debian/Ubuntu derived system with VMware installed:
It looks like Debian originally decided they didn’t want privmode because it broke UUCP (!?).
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=52586
VMware do list Debian/Ubuntu as supported host platforms though, so they have published a fix for this issue today. If you care about this and can’t wait for the patch, you can temporarily remove the setuid bit from vmware-mount like this:
In conclusion, too bad if an otherwise unexploitable bug becomes exploitable, that’s the price you pay for high quality uucp support in 2013 😉
P.S. If you don’t know what uucp is, you can read more about it on fidonet or at my gopher site.
P.P.S. I sent the dash maintainers a patch today, but I’m not sure if they’re interested.