压在透明的玻璃上c-国产精品国产一级A片精品免费-国产精品视频网-成人黄网站18秘 免费看|www.tcsft.com

ThinkPHP 5.0.* 遠程命令執行漏洞預警

0x00 事件背景

2019年1月11日,360CERT發現某安全社區出現關于ThinkPHP5 RCE漏洞的威脅情報,不久之后ThinkPHP5官方與GitHub發布更新。

該更新修復了一處嚴重漏洞,該漏洞可導致遠程命令代碼執行

0x01 影響范圍

ThinkPHP 5.0.x

  • 5.0.x ~ 5.0.23

0x02 修復建議

官方在GitHub中進行了更新:版本更新

enter description here

  • 升級代碼到最新版本5.0.24
  • 同時建議用戶在線上環境中關閉debug模式

0x03 漏洞驗證

該漏洞危害高,影響嚴重:

enter description here

0x04 漏洞分析

漏洞主要出現在ThinkPHP?Request類的method方法中 (thinkphp/library/think/Request.php)

Request類可以實現對HTTP請求的一些設置,其中成員方法method用來獲取當前請求類型,其定義如下:

enter description here

當傳入的參數為false的時候,會取配置項var_method,其默認值為_method

enter description here

$this->{$this->method}($_POST); 通過post參數_method可以實現對當前類的任意方法進行調用。

通過調用當前類的構造方法可以覆蓋任意成員屬性的值:

enter description here

這里通過覆蓋filter屬性,filter屬性保存了用于全局過濾的函數。

但是在thinkphp5.0.23中,會對filter值重新賦值為空,導致無法利用。

enter description here

在thinkphp/library/think/App.php中開啟debug的時候會調用Request類的param方法。

在thinkphp/library/think/Request.php param方法中會調用到method方法,并將參數設置為true。

enter description here

當參數為true的時候,會調用server方法

enter description here

enter description here

會走到 input方法,通過之前方法覆蓋server成員屬性值為array(),input方法代碼如下:

enter description here最終會調用filterValue形成任意代碼執行:

enter description here

0x05 時間線

2019-01-11?360CERT發現漏洞威脅情報

2019-01-11?ThinkPHP發布補丁更新

2019-01-11?360CERT發布預警分析

0x06 參考鏈接

  1. ThinkPHP5 github更新

上一篇:云+IPV6:2019路由器技術發展趨勢前瞻

下一篇:“安全+”沙龍第十四期在上海成功舉辦/1月4日