Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Re: Quotes In CGI

by Anonymous Monk
on Oct 07, 2002 at 22:35 UTC ( #203518=note: print w/replies, xml ) Need Help??

in reply to Re: Quotes In CGI
in thread Quotes In CGI

I'm sure that you realize that single-quotes aren't the only reason the above code is very, very bad. If, for example, someone were to figure out what you're doing, they could call your script like this:

This would eval (I think -- it's not tested), and do some potentially nasty things. I'm not devious enough to come up with something really nasty to do in a system call, but you get the idea... jpt

Replies are listed 'Best First'.
Re: Re: Re: Quotes In CGI
by jlongino (Parson) on Oct 08, 2002 at 03:37 UTC
    You are correct, although your example would not work as you intended, something along the lines of the following would:
    script.cgi?x=' . system "any valid OS command here" . '
    the eval of which would look like this:
    $x = '' . system "any valid OS command here" . '';
    In this particular case, the UnTaint would not find any "naughty" symbols we associate with usual system cracking attempts. My focus, however was to address the cause of the poster's immediate problem. The references to the other links and the warning I think were sufficient. In his CGI Course, Ovid addresses these and other security issues.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://203518]
[marto]: I can relate to that somewhat, I'm a light sleeper and frequently get woken up by kids doing much the same as your cats
[jedikaiti]: Yea, the kids (& the cats) are good at that
talexb is having a hard time with Windows losing DNS info for Perlmonks when voting. CB works fine. Ugh.
[jedikaiti]: how odd

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (14)
As of 2017-07-25 15:12 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (374 votes). Check out past polls.