thinkphp框架,先报错,查看版本

thinkphp6.0版本,经查阅,存在任意文件写入
先注册一个账户,登录时将cookie修改成aaaaaaaaaaaaaaaaaaaaaaaaaaaa.php,一共32位

在搜索处可写入webshell

访问runtime/session/sess_aaaaaaaaaaaaaaaaaaaaaaaaaaaa.php

可以看到disable_functions过滤了很多函数

应该是要绕过disable_functions
先用蚁剑连接,这里我换了一下cookie,用来写一句话木马
可以看到本地有readflag,应该是通过readflag读取flag

下载一波绕过的exp,https://github.com/mm0r1/exploits
使用php7-gc-bypass的exploit,修改一下

将exploit上传到/var/tmp目录下
最后包含一下即可读取flag
<?php include(‘/var/tmp/exploit.php‘);?>

原文:https://www.cnblogs.com/mech/p/13758932.html