in reply to Read/Write ASCII file
A better way would be avoid the external grep command - unless you want people to be able to delete all your files!
Your code looks like this:
$ItemForm = param('item'); $OldLine = `grep $ItemForm stock.dat`;
Because you're not validating the input at all, (I'm suprised that the -T flag doesnt catch this), a malicious user could pass something like:
/cgi-bin/script.cgi?item=t%20/etc/passwd;%20rm%20-rf%20~;echo
This would make your command:
`grep t /etc/passwd; rm -rf ~; cat stock.dat`
You see the problem? ;)
Steve
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Security problem in your code ...
by Anonymous Monk on Jun 08, 2003 at 00:00 UTC | |
by skx (Parson) on Jun 08, 2003 at 13:26 UTC |