Yes, -s is very bad, but I hadn't realized just how bad until you posted this.... Among the many globals that I could tweak with -s were $< $> $) and $( which should raise
a huge security flag for anyone whos read perlvar. For instance, when saved as evildashs.pl, and envoked as:
in reply to perl -s is evil?
% ./evildashs.pl -\<=0 -\>=0 -\(=0 -\)=0
The following code might raise some eyebrows....
I don't think this actually gives the process any new powers, but it would allow someone to execute code that was only supposed to be invoked as root.
#! /usr/bin/perl -wsT
print "\$) = ", $), "\n";
print "\$( = ", $(, "\n";
print "\$< = ", $<, "\n";
print "\$> = ", $>, "\n";
$) = 0
$( = 0
$< = 0
$> = 0
Oh, right. I should include the obligatory link to Getopt::Std and Getopt::Long for a much better way to handle command line options.