Article View: comp.security.misc
Article #421Re: Secure setuid mount program - possible?
From: Casper H.S. Dik
Date: Wed, 19 Aug 1992 20:24
Date: Wed, 19 Aug 1992 20:24
55 lines
2114 bytes
2114 bytes
unruh@physics.ubc.ca (William Unruh) writes:
>ie,
>execlp("/etc/mount","mount","-t","pcfs","/dev/fd0","/pcfile",(char*)0)
% cp /bin/sh /tmp/mount_pcfs
% set path = ( /tmp $path)
% <your-mount-program>
#
When the environment is concerned there are two basic rules:
- if you spawn a process as the original user - keep it.
(E.g., xterm, screen)
- if you spwan a process as another user - kill it TOTALLY
(E.g., sendmail)
Programs as su & login are a bit different. I the normal case
they give access as another user. In that case no special care is
needed. Su & login must take care that a number of special
env vars are filtered. Which vars depends largely on the OS.
To give an example of really weird misuse of env vars (when using a C-shell
script as ``login shell'' of a user without a password).
/bin/somescript is a script that performs a root function for users
of a system. It is a C-shell script.
someuser::0:0:Pseudo user to perform Somefunction:/:/bin/somescript
Normal usage:
% su someuser
Thank you for performing some function!!
Now watch this:
% setenv TERM '`/bin/chmod 666 /etc/passwd; echo done > /dev/tty`'
% su someuser
done
<hangs-type your intr char>
The point is this: you should totally clean out the environment.
You have no way of knowing what variables are used and/or will
be used in the future. Not just junk IFS, cleanup PATH,
remove the lot.
Casper
--
| Casper H.S. Dik
| casper@fwi.uva.nl
--
| Casper H.S. Dik
| casper@fwi.uva.nl
Technical Details
Message-ID:
<1992Aug19.202407.19420@fwi.uva.nl>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!fwi.uva.nl!casperReferences:
<BUZZ.92Aug19092622@toxicavenger.bear.com> <k2.714234342@woodstock> <unruh.714243430@physics.ubc.ca>Show Full Headers
Complete Article Headers
Newsgroups: comp.security.misc Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!fwi.uva.nl!casper From: casper@fwi.uva.nl (Casper H.S. Dik) Subject: Re: Secure setuid mount program - possible? Message-ID: <1992Aug19.202407.19420@fwi.uva.nl> Sender: news@fwi.uva.nl Supersedes: <1992Aug19.200655.19273@fwi.uva.nl> Nntp-Posting-Host: adam.fwi.uva.nl Organization: FWI, University of Amsterdam References: <BUZZ.92Aug19092622@toxicavenger.bear.com> <k2.714234342@woodstock> <unruh.714243430@physics.ubc.ca> Date: Wed, 19 Aug 1992 20:24:07 GMT Lines: 55