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: fcda7,d4c1f7c0fe672a4 X-Google-Attributes: gidfcda7,public X-Google-Thread: 1020c6,d4c1f7c0fe672a4 X-Google-Attributes: gid1020c6,public X-Google-Thread: 1164f8,d4c1f7c0fe672a4 X-Google-Attributes: gid1164f8,public X-Google-Thread: 1070f0,d4c1f7c0fe672a4 X-Google-Attributes: gid1070f0,public From: flaps@dgp.toronto.edu (Alan J Rosenthal) Subject: Re: Different UNIX pro's and con's. Date: 1998/09/23 Message-ID: <1998Sep23.162945.20782@jarvis.cs.toronto.edu>#1/1 X-Deja-AN: 394174572 X-Nntp-Posting-Host: explorer.dgp.toronto.edu References: <35F71814.1E0B911C@iakom.com> <35FB108D.F8FEFEBE@home.com> <6ti5t2$lbr$1@Venus.mcs.net> <35FDE10D.3380C3C1@home.com> <6tkqni$m41@web.nmti.com> <36019311.0@news.thefree.net> <6tsafu$4cr$1@camco.celestial.com> <360253C8.BB71898@home.com> <3602837C.5A77@lmt.ens-cachan.fr> <3602C849.C70612C6@llnl.gov> <360688CC.45AA59CA@llnl.gov> Newsgroups: comp.sys.dec,comp.unix.admin,comp.sys.sun.admin,comp.sys.sgi.admin,comp.security.unix,comp.sys.hp.hpux Jim Mellander writes: >Well, I checked the source code to tmpwatch - there is a window (albeit >tiny) where someone could slip a symlink in place of a regular file. Yes, but this cannot cause the deletion of arbitrary files in the filesystem, it will just cause the deletion of the symlink, which is rogue anyway, and is in /tmp anyway. To use a tmp cleaner to delete arbitrary files with symlinks, you need to substitute a symlink for a DIRECTORY. This cannot be done with tmpwatch as far as I can see. (Of course there are other ways to fool some tmp cleaners, even down to files with wildcards or spaces in them. I don't believe tmpwatch has any of these other vulnerabilities, either, but the symlink substitution is the one which takes substantial work to evade, once you're writing something from scratch like tmpwatch (as opposed to using find).) (Note also that some of the proposals to chown files, etc, will actually INCREASE the vulnerabilities, because although unlink() does not follow symlinks, chown() and chmod() DO on most systems, chmod() unavoidably (because there is no lchmod()). This is not an issue for linux though (yay!).) >As I stated originally, unless you can be entirely sure that you won't swap >between deciding to delete a file, and the actual system call to delete >the file, there is an insecurity. If by "swap" you mean "substitute something else", then I think you are wrong, this does not in general lead to a vulnerability. It depends on what you can substitute for what. If by "swap" you mean "yield time to another process so that it might do something", this is unavoidable; some of those system calls will remove your "ready to run" status. And you might be on a multiprocessor machine anyway. Avoiding swapping is a single-user-system-oriented method of avoiding other activity; what you really want is atomic operations in the kernel. (I've wanted a rename3(), move Y to Z and X to Y in a single op, with a guarantee that even in error, ONE of them will end up being linked in as Y, and there will be no Y-less window... this would be a very general mechanism.) But I don't think that these are necessary for secure tmp cleaning. I would be extremely interested to hear of any vulnerabilities in tmpwatch, because I rely on it. (Actually, I have some arguably useful modifications to it which I have to get around to posting..... next term, too busy now...)