suid doesn't work

Maarten Litmaath mcvax!cs.vu.nl!maart at uunet.uu.net
Wed Feb 1 06:05:35 AEST 1989


phil at Rice.edu (William LeFebvre) writes:
> ...  So if the first line in a shell file is "#!/bin/sh" or
> "#!/bin/csh", then the file can actually be executed like it was a binary
> executable (it will run when invoked with a call to "exec").  Only this
> second form can be successfully set-uid.

And it's a security risk, discussed in comp.unix.wizards not too long ago.
For safe setuid scripts use David Goodenough's (dg at lakart.uucp) `secure'
program or my `setuid' program, both of which appeared in
comp.sources.misc.  These programs are to be specified as the interpreter
of the script:

	#! /bin/secure
or
	#! /bin/setuid

They in turn execute the real interpreter of the script, e.g. /bin/sh.
Using David's program there must be a database containing the names, uids
and interpreters of setuid scripts, and the scripts themselves needn't be
setuid because /bin/secure is setuid root; my program expects below the
`#!' line a line of the form:

	#? absolute-path-of-interpreter [args] absolute-path-of-file [args]

If you want to use my program, make sure you have version 1.1 or higher
(1.0 contained a race condition bug); I expect to see it in
comp.sources.misc any day from now.

	Maarten Litmaath @ VU Amsterdam:
	maart at cs.vu.nl, mcvax!botter!maart



More information about the Comp.sys.sun mailing list