Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What's to stop somebody from creating a setuid-root script on a flash drive, then putting it into another person's computer and getting root access? I assume there's some kind of protection against that, but I don't have a spare drive to test with.

share|improve this question
    
Are you just interested in scripts, as your question implies, or do you want information on similar types of apparent attacks? If just scripts, why? If not, could you please clarify your question? – Daniel H Aug 14 '11 at 6:38
up vote 5 down vote accepted

If a volume is mounted nosuid then the setuid bit is ignored on executables. At least newer versions of Fedora mount external media with this option.

Also, setuid does nothing for scripts unless the interpreter is prepared to run a separate copy of the interpreter as the user in question. Not many are.

share|improve this answer
2  
The script/suid issue isn't that big - you can always right a simple C program that just executes the shell. – Daniel H Aug 14 '11 at 6:18
    
@Daniel: Sure, but that's out of scope for this question. – Ignacio Vazquez-Abrams Aug 14 '11 at 6:19
    
… and the nosuid option would stop that binary from employing set-UID, too. – JdeBP Aug 15 '11 at 0:50
    
Interpreters won't get a choice in the matter of whether a separate process is run or not if the script is executable and employs #!, by the way. – JdeBP Aug 15 '11 at 0:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .