home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / security / misc / 1706 < prev    next >
Encoding:
Text File  |  1992-11-10  |  2.2 KB  |  58 lines

  1. Path: sparky!uunet!mcsun!ub4b!news.cs.kuleuven.ac.be!blekul11!frmop11!barilvm!vms.huji.ac.il!pita.cs.huji.ac.il!nntpserver!amoss
  2. Newsgroups: comp.security.misc
  3. Subject: Re: Setuid script - is this unsecure?
  4. Message-ID: <AMOSS.92Nov6102549@shuldig.cs.huji.ac.il>
  5. From: amoss@shuldig.cs.huji.ac.il (Amos Shapira)
  6. Date: 6 Nov 92 10:25:49
  7. References: <1992Nov5.071354.24042@kth.se>
  8. Organization: Inst. of Comp. Sci., Hebrew University, Jerusalem, Israel
  9. NNTP-Posting-Host: shuldig.cs.huji.ac.il
  10. In-reply-to: paf@cyklop.nada.kth.se's message of 5 Nov 92 07:13:54 GMT
  11. Lines: 45
  12.  
  13. In article <1992Nov5.071354.24042@kth.se> paf@cyklop.nada.kth.se (Patrik Fltstrm) writes:
  14.  
  15.    chiner@nova.gmi.edu writes:
  16.    >(Rick Tait) writes:
  17.    >: I recently installed these shell scripts on my machine (on which I am root),
  18.    >: and I'd like to know if I'm compromising it's security. Basically, they
  19.    >: just allow the users to mount/umount/eject the floppy disk (pcfs).
  20.    >
  21.    >:     /usr/etc/mount -t pcfs /dev/fd0 /pcfs
  22.    >                            ^-o nosuid
  23.    >:
  24.    >and some other problems...  I'll point out, that all the mount commands
  25.    >need a -o nosuid...  otherwise, anyone who can get a root shell on a disk,
  26.    >can get root on your system...
  27.  
  28. I didn't see the entire thread from the beginning, but it seems to me you are
  29. all missing the main problem with suid shell scripts, which is the bug in the
  30. shell itself and the flexibility it offers with environment variables.
  31.  
  32. I can become root on your system using your /bin/sh script without even having
  33. to know what it does or what programmes it calls.
  34.  
  35. suid shell script is a no-no. period.
  36.  
  37. If you want an suid programme write it in C (even if it does dumb things) and
  38. don't use the system(3) and popen(3) functions because they call /bin/sh and
  39. hance it's almost like writing a shell script.  I bet people can find some more
  40. rules-of-thumb but these are the very basic ones you should follow.
  41.  
  42. A general suggestion for a programme which will do what you want would be:
  43.  
  44. main (ac, av)
  45.     int ac;
  46.     char **av;
  47. {
  48.     exec ("/usr/etc/mount", av);
  49. }
  50.  
  51. and have the object of this C programme suid root.
  52.  
  53. Hope this helps,
  54. --
  55. --Amos Shapira (Jumper Extraordinaire)
  56. C.S. System Group, Hebrew University, Jerusalem, Israel
  57. amoss@cs.huji.ac.il
  58.