用户工具

站点工具


thinkphpbug1

近期,Thinkphp社区发布最新thinkphp框架漏洞,存会可能会被黑客攻击,导至远程执行代码,

以及可能在服务器上运行脚本的漏洞

漏洞涉及影响目前素玄PHP的所有项目,

为保险期间,务必将所有PHP项目升级到最新版,影响的项目包括:CRM,MC,客服,接单,云底片,会员,商城,云选片,OA。

如何检查程序版本是否是已经修复过了:

进入到相关项目的跟目录,如CRM: 进入:d:\suxuantech\www\apps\crm\

在此目录下依次进入:thinkphp/library/think/App.php

右键这个文件,然后右键选择Edit with Notepad++ 打开该文件,然后拉到大概376行左右,代码如以下形式,表示需要升级

      // 获取控制器名
      $controller = strip_tags($result[1] ?: $config['default_controller']);
      $controller = $convert ? strtolower($controller) : $controller;
      
      // 获取操作名
      $actionName = strip_tags($result[2] ?: $config['default_action']);
      $actionName = $convert ? strtolower($actionName) : $actionName;

如果是以下代码,表示程序是最新的,不需要升级。

      // 获取控制器名
      $controller = strip_tags($result[1] ?: $config['default_controller']);
      $controller = $convert ? strtolower($controller) : $controller;
      if (!preg_match('/^[A-Za-z](\w|\.)*$/', $controller)) {
          throw new HttpException(404, 'controller not exists:' . $controller);
      }
      // 获取操作名
      $actionName = strip_tags($result[2] ?: $config['default_action']);
      $actionName = $convert ? strtolower($actionName) : $actionName;

类似如下图所示:

添加的代码如下:

  if (!preg_match('/^[A-Za-z](\w|\.)*$/', $controller)) {
      throw new HttpException(404, 'controller not exists:' . $controller);
  }
thinkphpbug1.txt · 最后更改: 2018/12/23 12:42 由 songdemei