周五下午爆洞能不能让人们好好休个周末!
本次漏洞关键位置:/thinkphp/library/think/Request.php
,lines:501由图可以看到在method函数中引入了可控的数据来源:


isset($_POST[Config::get('var_method')
$this->method
在取得该数据的值之后动态调用$this->{$this->method}($_POST)
,漏洞的关键位置即在该位置。攻击者调用该类任意函数,并通过$_POST
作为参数。动态调用__construct
函数即导致代码执行。
下图为Request类中包含的__construct
函数内容(lines:130):从中我们可以看到通过$options
参数,攻击者可以覆盖到filter、method
属性以及get属性的值。

同时在Request
当中的param
函数(lines:617)中可以看到当$this->arrayParam
为空时,即调用$this->get(false)
。

$this->Get
函数(lines:673)内容如下:在get函数末端我们可以看到其调用了input
函数将攻击者可控的get
内容进行了传值。

input
函数内容如下(lines:976):

我们可以看到getFilter
(lines:1005),继续跟踪至getFilter
函数(lines:1035):

Filter
返回后即进入input
函数中解析过滤器的if当中,紧接着其调用了filtervValue
函数(lines:1059):从中我们不难发现$filter
和$value
均可自行控制。

攻击还原(仅供技术交流,请勿非法测试)

影响范围
5.0.X<Thinkphp<5.0.24
防御方案
版本升级到5.0.24最新版本规避漏洞
参考链接: https://github.com/top-think/framework/commit/4a4b5e64fa4c46f851b4004005bff5f3196de003?diff=split
网友评论