4 ms·
It's vulnerable because the user controls the content of $userinput, the variable name doesn't matter. Real code would look like this: #!/usr/bin/perl pri
by jkn 14y ago
It's vulnerable because the user controls the content of $userinput, the variable name doesn't matter. Real code would look like this:
#!/usr/bin/perl
print "Enter filename: ";
$filename = <STDIN>;
open(file_handler, "$filename");
If you see this code, you know that you can execute any command by giving it at the filename prompt and appending a '|' character. For example giving cat /etc/passwd |zenity --text-info | will popup a dialog with the content of /etc/passwd.
- bgilroy26 14y agoOh I see, I thought you were talking about something that would be caught by the interpreter if you put use strict; and use warnings; in there. Thank you for taking the time to put in an example, I understand you better now.