A fully containerized Proof of Concept (PoC) demonstrating the exploitation of Spring4Shell (CVE-2022-22965), resulting in Remote Code Execution (RCE) against a vulnerable Spring Framework application deployed on Apache Tomcat.
The project recreates the complete vulnerable environment to facilitate security research, penetration testing practice, vulnerability analysis, and defensive learning in a safe and reproducible laboratory.
Disclaimer
This repository is provided strictly for educational, research, and authorized security testing purposes. The vulnerable environment is intentionally insecure and must only be executed in isolated lab conditions. The author assumes no responsibility for misuse or any damage resulting from the use of this project.
Spring4Shell (CVE-2022-22965) is a critical Remote Code Execution vulnerability affecting specific versions of the Spring Framework when deployed on Apache Tomcat under particular runtime conditions.
This repository provides a fully reproducible laboratory environment that allows researchers and students to understand:
- how the vulnerability works;
- the exploitation workflow;
- the conditions required for successful exploitation;
- practical mitigation strategies.
The application is completely isolated inside a Docker container, allowing experimentation without affecting the host operating system.
| Component | Version | Description |
|---|---|---|
| Spring Boot | 2.6.2 | Vulnerable application |
| Spring Framework | 5.3.14 | Vulnerable version |
| Apache Tomcat | 9.0.60 | Servlet container |
| Java | JDK 11 | Required runtime |
| Operating System | Ubuntu 24.04 | Docker container |
.
├── Dockerfile
├── pom.xml
├── src/
│ ├── main/
│ └── test/
├── README.md
└── exploit/
git clone https://github.com/<username>/<repository>.git
cd <repository>docker build -t spring4shell:2.6.2 .docker run -p 8080:8080 spring4shell:2.6.2The application will be available at:
http://localhost:8080
The repository demonstrates the complete attack chain:
- Deploy the vulnerable application.
- Verify exploit prerequisites.
- Deliver the malicious payload.
- Modify Tomcat logging configuration.
- Write the malicious JSP web shell.
- Execute arbitrary commands through the deployed shell.
This project covers several important offensive security concepts:
- Spring MVC Data Binding
- Java Reflection
- Apache Tomcat internals
- Remote Code Execution (RCE)
- Web Application Security
- Vulnerability Reproduction
- Secure Lab Deployment
- Defensive Analysis
To mitigate CVE-2022-22965:
- Upgrade to a patched version of the Spring Framework.
- Upgrade Apache Tomcat where applicable.
- Apply the official Spring Security advisories.
- Restrict unnecessary data binding.
- Continuously patch application dependencies.
- Never expose intentionally vulnerable environments to public networks.
- CVE-2022-22965
- Spring Security Advisory
- VMware Security Advisory
- Apache Tomcat Documentation
- NIST National Vulnerability Database (NVD)
⭐ If you find this project useful for learning or security research, consider giving it a star ⭐