From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10952f,b69d377feb5a8a2 X-Google-Attributes: gid10952f,public X-Google-Thread: 10872d,d4c1f7c0fe672a4 X-Google-Attributes: gid10872d,public X-Google-Thread: 1020c6,d4c1f7c0fe672a4 X-Google-Attributes: gid1020c6,public X-Google-Thread: 1164f8,d4c1f7c0fe672a4 X-Google-Attributes: gid1164f8,public X-Google-Thread: fcda7,d4c1f7c0fe672a4 X-Google-Attributes: gidfcda7,public X-Google-Thread: 1070f0,d4c1f7c0fe672a4 X-Google-Attributes: gid1070f0,public From: pjb1008@cus.cam.ac.uk (Peter Benie) Subject: Re: Secure cleaning of /tmp was Different Unixes pros & cons Date: 1998/09/23 Message-ID: <6ubs6f$jk5$1@pegasus.csx.cam.ac.uk>#1/1 X-Deja-AN: 394156363 References: <35F71814.1E0B911C@iakom.com> <6u67of$cae@web.nmti.com> <51zN1.54$LN.897820@burlma1-snr1.gtei.net> <6u6gie$fgk@web.nmti.com> Organization: Unix Support, University of Cambridge Computing Service Followup-To: comp.security.unix Newsgroups: comp.unix.admin,comp.sys.hp.hpux,comp.sys.sgi.admin,comp.sys.sun.admin,comp.sys.dec,comp.security.unix In article <6u6gie$fgk@web.nmti.com>, Peter da Silva wrote: >Barry Margolin wrote: >>If your goal is to avoid race conditions that can be used as security >>holes, you're probably right. But if your goal is a fully correct /tmp >>cleaner, possibilities like this will always exist unless special kernel >>support is provided. > >There's a number of hacks you can use to get the same result, though they >do require moderate exotica... they're not specifically kernel support for >temp cleaning. These techniques still don't identify which files are genuinely finished with. (Every so often, users ask for files in /tmp to be recovered from backups!) Nor do they delete structured groups of files together - you can't do that under Unix without the cooperation of the program that created them. Since a fully correct /tmp cleaning program is impossible under Unix, it's not worth spending much effort trying to make one. >If you have variable symlinks you can pull a nasty trick: > ln -s '/usrtmp/$(LOGNAME)/tmp' /tmp # modulo variable symlink syntax > >Now anyone accessing /tmp will find themselves in a private temp dir they own. I'm not too keen on variable symlinks, especially for /tmp. Suppose an unprivileged user sets LOGNAME to "../net/nfs-server-name". If a set-id program were to use a temporary file, that would give the user access to what the program wrote, and control over what the program read back. [Follow-ups trimmed.] Peter