home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / security / misc / 1652 < prev    next >
Encoding:
Internet Message Format  |  1992-11-06  |  2.1 KB

  1. Path: sparky!uunet!ferkel.ucsb.edu!taco!rock!stanford.edu!agate!doc.ic.ac.uk!uknet!mcsun!Germany.EU.net!news.netmbx.de!mailgzrz.TU-Berlin.DE!math.fu-berlin.de!news.th-darmstadt.de!rbg.informatik.th-darmstadt.de!misar
  2. From: misar@rbg.informatik.th-darmstadt.de (walter misar)
  3. Newsgroups: comp.security.misc
  4. Subject: Re: Setuid script - is this unsecure?
  5. Message-ID: <1992Nov5.214601@rbg.informatik.th-darmstadt.de>
  6. Date: 5 Nov 92 20:46:01 GMT
  7. References: <1d6fdiINNf5q@bnsgd245.bnr.co.uk>
  8. Sender: news@news.th-darmstadt.de (The News System)
  9. Organization: TU Darmstadt
  10. Lines: 44
  11. Nntp-Posting-Host: rbhp63.rbg.informatik.th-darmstadt.de
  12.  
  13. In article <1d6fdiINNf5q@bnsgd245.bnr.co.uk>, rickt@bnr.co.uk (Rick Tait) writes:
  14. > I recently installed these shell scripts on my machine (on which I am root),
  15. > and I'd like to know if I'm compromising it's security. Basically, they
  16. > just allow the users to mount/umount/eject the floppy disk (pcfs).
  17. > In: (mount script)
  18. > #!/bin/sh --
  19. > if ( test ${#} -eq 0 ) then
  20. >     /usr/etc/mount -t pcfs /dev/fd0 /pcfs
  21. >     else
  22. >        if ( test ${1} = "ro" ) then
  23. >          /usr/etc/mount -t pcfs -o ro /dev/fd0 /pcfs
  24. >        else
  25. >          if ( test ${1} = "rw" ) then
  26. >            /usr/etc/mount -t pcfs /dev/fd0 /pcfs
  27. >          else
  28. >            echo Invalid argument -- not mounted
  29. >          fi
  30. >        fi
  31. > fi
  32. > Out: (unmount/eject script)
  33. > #!/bin/sh -- 
  34. > /usr/etc/umount /pcfs
  35. > eject
  36. > So do these make my system insecure? How? How the hell would a user
  37. > turn these simple scripts over into something to compromise my IPX?
  38.  
  39. I don't think there will ever be a secure setuid shellscript:
  40.  
  41. Despite the fact  #!/bin/sh -- is much more better than #!/bin/sh
  42. there are at least to holes in the script: 
  43. First eject has no PATH so a user could write a malicious shellscript
  44. with name /tmp/eject, cd to /tmp and set PATH to . :his shellscript will
  45. then run under root.
  46. Second you can fool /bin/sh to take every / as an blank and do the trick
  47. above even if all cmds are preceeded by their full path.
  48.  
  49. Moral: don't use setuis shellscripts - write it in C or pearl instead.
  50.  
  51. Walter
  52.    
  53.