I have written a cgi filter script for the new phpBB exploit and have in the past had the script email the site admin that an attack attempt has happened. Now that the manual attempts at exploits have all but stopped and now that the worm is hitting sites sometimes thousands of times a day, I have decided to have the script extract the domain name from the encoded hex/unicode exploit string and grab the admin email from whois (if it exists) and email the admin and notify them their site is infected.
Now with that said I of course am using taint mode so in order to pass data to an open() call I am piping to "-" and trying to temporarily printing the output of the whois command to a cgi generated webpage just to verify the data is there before I extract the email address. However the return value of my filehandle is null and I can not see any reason why it would be this way. I have taken this example and put it in a test command line script and it executes like it is suppose to.
Here is the section of code:
if ($domain) {
open(LKUP, "-|") || exec("ls"); #exec("whois", $domain);
print while <LKUP>;
}
As you can see I have commented out the real exec() call I want to run and simply am trying to get the output to list the contents of the current dir. I get nothing printed from the print statement however.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.