🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
1 messages
1 total messages Started by Alec Muffett Fri, 29 Nov 1996 00:00
Re: newsreader <-> wwwbrowser (was: Re: X Mosaic wish lists )
#27984
Author: Alec Muffett
Date: Fri, 29 Nov 1996 00:00
57 lines
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/

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads