I have run the following code on Win32 using ActiveState perl 5.6.
#!/usr/local/bin/perl -Tw
use CGI ':standard';
$file = param('file');
$comment = param('comment');
unless ($file) { $file = 'xcanalys.txt'; }
unless ($comment) { $comment = 'No comment'; }
open (OUTPUT, ">>./" . $file) or die "$!";
print OUTPUT $comment . "\n";
close OUTPUT;
print header, start_html;
print "<P>Thanks!</P>\n";
print end_html;
1;
Here is the command line:
perl -T tainttest.pl
(offline mode: enter name=value pairs on standard input)
^Z
Without untainting the information coming out from param(), this short script appends to the file! Isn't this supposed to fail?
Celebrate Intellectual Diversity