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: 1070f0,d4c1f7c0fe672a4 X-Google-Attributes: gid1070f0,public X-Google-Thread: 1164f8,d4c1f7c0fe672a4 X-Google-Attributes: gid1164f8,public X-Google-Thread: fcda7,d4c1f7c0fe672a4 X-Google-Attributes: gidfcda7,public X-Google-Thread: 10872d,d4c1f7c0fe672a4 X-Google-Attributes: gid10872d,public X-Google-Thread: 1020c6,d4c1f7c0fe672a4 X-Google-Attributes: gid1020c6,public From: Jim Mellander Subject: Re: Secure cleaning of /tmp was Different Unixes pros & cons Date: 1998/09/21 Message-ID: <36069B1E.14553C26@llnl.gov>#1/1 X-Deja-AN: 393364765 Content-Transfer-Encoding: 7bit References: <35F71814.1E0B911C@iakom.com> <3602E82F.C8638268@llnl.gov> <6tuuep$kks@web.nmti.com> <360674DF.C1EDCEAF@llnl.gov> <36067E43.598E55E1@llnl.gov> <36068E8D.567E2F02@llnl.gov> Content-Type: text/plain; charset=us-ascii Organization: Lawrence Livermore National Laboratory Mime-Version: 1.0 Newsgroups: comp.unix.admin,comp.sys.hp.hpux,comp.sys.sgi.admin,comp.sys.sun.admin,comp.sys.dec,comp.security.unix Steve "Stevers!" Coile wrote: > > On Mon, 21 Sep 1998, Jim Mellander wrote: > [...] > > Actually, my example was a little weak, it was just for demo purposes. > > You could just as well use a single word command surrounded by > > backticks. bash seems to handle the cd correctly, but other unix shells > > don't, for instance under AIX: > > > > cd "`my_prog`" > > > > will run my_prog before attempting the cd > > Yeah, but the following two are not equivalent (which I believe is where > your misunderstanding is: > > cd "`my_prog`" > > x='`my_prog`' > cd "$x" > > In the second example, $x will be expanded, but the expansion will not > then be interpreted. There is *NO CHANCE* that the value of $x could > cause unexpected side effects by executing arbitrary shell commands, > even if the value of $x contains double quotes ("), single quotes ('), > backtics (`), or other shell metacharacters. > > -- > Steve Coile Red Hat Software > scoile@redhat.com Systems Administration You're correct. Thank you for clearing that up. However, I have yet to see a program to clean /tmp that is not vulnerable to race conditions. The only idea that I have come up with: setting job priority to Real-Time, doing the check & rm, then going back to regular priority, has a severe flaw if /tmp is NFS-mounted, and the NFS server goes down, then the system will completely freeze. Of course, you would have to be an idiot to put /tmp on NFS, but I've seen worse.