Spring Cloud Function SPEL表达式注入漏洞复现

  1. 影响组件及版本

org.springframework.cloud:spring-cloud-function-context(影响版本:3.0.0.RELEASE~3.2.2)

  1. 缺陷前置条件

properties中配置spring.cloud.function.definition=functionRouter

  1. 漏洞描述
    Spring Cloud Function 是Spring cloud中的serverless框架。
    Spring Cloud Function 中的 RoutingFunction 类的 apply 方法将请求头中的“spring.cloud.function.routing-expression”参数作为 Spel 表达式进行处理,造成 Spel 表达式注入漏洞。
    攻击者可通过该漏洞执行任意代码。
  2. 漏洞复现

安装JDK 9

 

配置JDK环境变量

配置Apache Maven 

配置Apache Maven 环境变量

打包Spring项目

 

运行

利用成功

 

  1. 漏洞修复建议

https://github.com/spring-cloud/spring-cloud-function/commit/0e89ee27b2e76138c16bcba6f4bca906c4f3744f

 

posted @ 2022-03-31 00:49  你似雾  阅读(387)  评论(0编辑  收藏  举报