ThinkPHP5 <= 5.0.22 遠程代碼執行高危漏洞

漏洞描述

因爲ThinkPHP5框架對控制器名沒有進行足夠的安全檢測,致使在沒有開啓強制路由的狀況下,黑客構造特定的請求,可直接GetWebShell。php

漏洞評級

嚴重thinkphp

影響版本

ThinkPHP 5.0系列 < 5.0.23
ThinkPHP 5.1系列 < 5.1.31shell

安全版本

ThinkPHP 5.0系列 5.0.23
ThinkPHP 5.1系列 5.1.31安全

ThinkPHP5.*版本發佈安全更新

本次版本更新主要涉及一個安全更新,因爲框架對控制器名沒有進行足夠的檢測會致使在沒有開啓強制路由的狀況下可能的getshell漏洞,受影響的版本包括5.05.1版本,推薦儘快更新到最新版本。

若是各類緣由暫時沒法更新到最新版本(早期版本升級到最新版本可能存在兼容性問題,請首先參考官方手冊的升級指導章節)框架

手動修正

5.1版本spa

thinkphp/library/think/route/dispatch/Url.php  類的parseUrl方法,解析控制器後加上   添加code

 if ($controller && !preg_match('/^[A-Za-z](\w|\.)*$/', $controller)) {
     throw new HttpException(404, 'controller not exists:' . $controller);
 }blog

 

5.0版本路由

thinkphp/library/think/App.php  類的module方法的獲取控制器的代碼後面加上get

if (!preg_match('/^[A-Za-z](\w|\.)*$/', $controller)) {
    throw new HttpException(404, 'controller not exists:' . $controller);

}

 

框架升級

相關文章
相關標籤/搜索