setuid?

Guy Harris guy at auspex.auspex.com
Thu May 10 04:01:20 AEST 1990


>My mistake--a correction: System V Release 4.0 does support set-uid
>shell scripts if the !# notion is used.  I've tried this with the
>bourne and korn shells.

It should work with the C shell as well, although since the C shell is
derived from the 4.3BSD one, you have to put the "-b" flag in the "#!"
line.

You should, of course, put the "-" flag in the "#!" line for the Bourne
or Korn shells (unless you *like* security holes).  Of course, you
should also make sure you set IFS and PATH very early on in the script
(or "path" if the C shell).  There are probably various other things you
should do in order to make a less-insecure set-UID shell script.  I
don't know whether it's possible to make a secure set-UID shell script
or not; people have probably thought so in the past, and been rudely
surprised....

>Support code for SVVS:
>{int fd=open("/dev/zero",0);mmap(0,0x800,1,0x11,fd,0);close(fd);}

Oh, dear.  Won't people - people writing the SVVS, in particular -
*EVER* learn to stop dereferencing null pointers?  Sigh....

(For the benefit of those not familiar with "mmap()" or "/dev/zero", the
above sequence of code amounts to "stuff a 2K zero-fill-on-demand
read-only page at location zero", for the benefit of stupid code that
doesn't check for NULL pointers.)



More information about the Comp.unix.wizards mailing list