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: 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 X-Google-Thread: 1020c6,d4c1f7c0fe672a4 X-Google-Attributes: gid1020c6,public From: Barry Margolin Subject: Re: Secure cleaning of /tmp was Different Unixes pros & cons Date: 1998/09/21 Message-ID: <5UwN1.44$LN.735137@burlma1-snr1.gtei.net>#1/1 X-Deja-AN: 393364764 Distribution: world References: <35F71814.1E0B911C@iakom.com> <360674DF.C1EDCEAF@llnl.gov> <36067E43.598E55E1@llnl.gov> X-Trace: burlma1-snr1.gtei.net 906402433 4.2.32.97 (Mon, 21 Sep 1998 18:27:13 GMT) Organization: GTE Internetworking, Cambridge, MA NNTP-Posting-Date: Mon, 21 Sep 1998 18:27:13 GMT Newsgroups: comp.unix.admin,comp.sys.hp.hpux,comp.sys.sgi.admin,comp.sys.sun.admin,comp.sys.dec,comp.security.unix Originator: barmar@bbnplanet.com (Barry Margolin) In article <36067E43.598E55E1@llnl.gov>, Jim Mellander wrote: >How about a directory named `cat /etc/shadow` (including the >back-quotes). When I run cd "`cat /etc/shadow`" on Solaris 2.6 I get: > > > not found. Still not a problem: Bourne shell: $ foo='`cat /etc/shadow`' $ cd $foo `cat: does not exist $ cd "$foo" `cat /etc/shadow`: does not exist Korn shell: $ foo='`cat /etc/shadow`' $ cd $foo ksh: cd: bad substitution $ cd "$foo" ksh: `cat /etc/shadow`: not found As you can see, the only processing done on the result of variable interpolation is parsing of argument delimiters ($IFS), and only when the substitution isn't inside a quoted string. Backticks, semicolons, pipes, and redirection are recognized before interpolation. There *are* some scripts that can be susceptible to problems like these. Mainly, they involve use of "eval", "sh -c " or some similar mechanism to construct a whole new command line (Perl scripts using system() are often susceptible). But the script in this thread is not like that. -- Barry Margolin, barmar@bbnplanet.com GTE Internetworking, Powered by BBN, Burlington, MA *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.