Article View: news.software.readers
Article #27984Re: newsreader <-> wwwbrowser (was: Re: X Mosaic wish lists )
From: Alec Muffett
Date: Fri, 29 Nov 1996 00:00
Date: Fri, 29 Nov 1996 00:00
57 lines
2235 bytes
2235 bytes
cbbrowne@wolfe.brownes.org (Christopher B. Browne) writes:
> #!/bin/ksh
> eval netscape -remote "openURL\($1\)" </dev/null >/dev/null 2>&1
> if [ $? != 0 ]; then
> eval nohup netscape "$1" </dev/null >/dev/null 2>&1 &
> fi
Great security hole here; if someone embeds the string
`rm -rf $HOME`
- (or something equally nasty) in the URL, then it'll remove your home
filestore (or something equally nasty), because of the "eval".
07:40:59 crypto:alecm $ foo='`echo REMOVING HOME FILESTORE`'
07:41:37 crypto:alecm $ eval ls "$foo"
ls: REMOVING: No such file or directory
ls: HOME: No such file or directory
ls: FILESTORE: No such file or directory
- by the time the command gets round to executing the output of
`echo REMOVING HOME FILESTORE`
...it's too darn late.
If you drop the "eval", you get:
07:42:21 crypto:alecm $ ls "$foo"
ls: `echo REMOVING HOME FILESTORE`: No such file or directory
So why not just do:
#!/bin/sh
if netscape -remote "openURL\($1\)" </dev/null >/dev/null 2>&1
then
: ok
else
nohup netscape "$1" </dev/null >/dev/null 2>&1 &
fi
> Presumably something similar can be done with XMosaic.
Using signals and a little file in $HOME to contain the URL, I seem to
remember...
Just remember the first law of computer security: never, ever, blindly
execute ("eval") a string that someone hands to you...
--
alec muffett, oxford, england
please reply to: alecm @ crypto.dircon.co.uk (without spaces)
http://www.users.dircon.co.uk/~crypto/
Technical Details
Message-ID:
<m33extjqv3.fsf@crypto.dircon.co.uk>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.infosystems.www.browsers.x.mbox.zip!not-for-mailReferences:
<55sr1t$25g@btr0x6.hrz.uni-bayreuth.de>Show Full Headers
Complete Article Headers
Message-ID: <m33extjqv3.fsf@crypto.dircon.co.uk> Subject: Re: newsreader <-> wwwbrowser (was: Re: X Mosaic wish lists ) Date: Fri, 29 Nov 1996 00:00:00 +0000 From: Alec Muffett <alecm@crypto.dircon.co.uk%antispam> References: <55sr1t$25g@btr0x6.hrz.uni-bayreuth.de> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.infosystems.www.browsers.x.mbox.zip!not-for-mail X-Deja-AN: 201379006 Organization: Disorganised Newsgroups: comp.infosystems.www.browsers.x,news.software.readers