Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: running a perl program from a cgi webpage

by mephit (Scribe)
on Jul 04, 2002 at 17:23 UTC ( [id://179504]=note: print w/replies, xml ) Need Help??


in reply to running a perl program from a cgi webpage

I agree that there are security issues that need to be addressed here. One thing that I didn't see at that link that Joost mentioned here ('cause it's not really a CGI issue) is the use of system.

The OP is using the single-argument form, with part of that argument taken directly from the form input. Bad Idea. Use the multiple-argument form of system after validating the form input, that each variable contains only data that's expected:

system ("/var/www/perl/cgi_classification.pl", $outfile, $input_sequen +ce, $name);

This line looks hairy, as well:

open OUTFILE, ">/var/www/data/$ARGV[0]" or die "cannot....";
I don't know whether $ARGV[0] is tainted, but I'd validate it before opening, anyway.
my $filename = $ARGV[0]; # Use whatever regex suits your needs. this is just an example. if ($filename =~ /^([\w]+\.[\w]+)$/) { $filename = $1; } else { # handle the error here }

HTH

--

There are 10 kinds of people -- those that understand binary, and those that don't.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://179504]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-19 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found