Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: shell script cgi

From: Brian Hatch <vuln-dev(at)ifokr.org>
Date: Sat Nov 16 2002 - 11:29:38 EST

> thought the wrong way in my last message.
>
> Try the following string for $HTTP_USER_AGENT:

The HTTP_USER_AGENT string is set by Apache (etc) as an environment variable. Let's make the unradical assumption that your browser is not a shell script, and thus is setting it correctly without any shell expansion problems possible. So HTTP_USER_AGENT is set to

        `cat /etc/passwd`

To emulate this, let's set it ourselves in a normal shell:

	bash$ export VAR='`cat /etc/passwd`'
	bash$ echo $VAR
	`cat /etc/passwd`

I use the single quotes here to make sure no expansion tricks are possible, which is how your web browser will work. The var is set exactly. Excellent. Can we abuse it?

	bash$ echo $VAR
	`cat /etc/passwd`
	bash$ echo "$VAR"
	`cat /etc/passwd`

Nope. How 'bout if we have:

	bash$ export VAR='blahblahblah *'
	bash$ echo $VAR
	blahblahblah file1.cgi file2.cgi file3.cgi
	bash$ echo "$VAR"
	blahblahblah *
Do you need help?X

See that with no quotes you can get a file listing through shell expansion.

--
Brian Hatch                  I used to be a lumberjack,
   Systems and                but I just couldn't hack
   Security Engineer          it, so they gave me the ax.
http://www.ifokr.org/bri/

Every message PGP signed

  • application/pgp-signature attachment: stored
Received on Sat Nov 16 21:33:22 2002

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:07:37 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library