Critical Zero-Day RCE Vulnerability in Spring Core: Spring4shell (CVE-2022-22965)
Written by Aarush Ahuja
Co-founder @ FourCore
TL;DR: CVE-2022-22965 is a Critical Zero-Day RCE Vulnerability in Spring Core due to how parameters are deserialized to Java objects by Spring. We have created an open-source exploit PoC with a vulnerble application and exploit payload you can try right now: spring4shell-exploit-poc.
How was Spring4shell or CVE-2022-22965 discovered?
On March 29th 2022, A chinese security researcher on Twitter released screenshots showing RCE in a Spring Core application which is now assigned CVE-2022-22965. The researcher also released a Python exploit and a vulnerability report written in Chinese. The tweets have since been deleted and the researcher has deleted their accounts.
The assigment of the CVE took some time as to analyse and confirm the vulnerability posted by the researcher. The CVE was assigned on March 31st, 2022, given a Critical and a CVSS score of 9.8.
How does Spring4shell work?
Our HelloController below contains a @PostMapping to /greeting. When we request this route via the Tomcat server, http://app/helloworld/greeting, it transforms the HTTP request data into a POJO or Plain Old Java Object, in this case, a Greeting object. Under the hood, Spring uses deserialization to convert this request data into Java objects, mapping each field to a value in the Java object. As it turns out, you can set many more fields including the properties of a class.
The impact of vulnerability is wide as it is trivial to exploit and a large amount of Java applications are using Spring. Thus, explaining the high CVSS score. The prequisities to exploit it are common:
JDK version 9+
Application built on Spring Or derived frameworks
Running Tomcat with WAR deployment
Depending on frameworks and libraries is essential, however, vulnerabilities such as Spring4Shell and Log4Shell pose immense risk to the organization. You want to ensure that your security controls are working across the attack surface. FourCore ATTACK can help you ensure this by routinely assessing your security controls with real-world attack simulations.