Update as of 31st March: Spring has Confirmed the RCE in Spring Framework. The team has just published the statement along with the mitigation guides for the issue. Now, this vulnerability can be tracked as CVE-2022-22965.
This vulnerability is NOT as bad a Log4Shell. All attack scenario are more complex because of the nature of Class Loader Manipulation attacks work in Java. Spring4Shell exploitation requires deep Java knowledge to get a functioning POC. Class Loader Manipulation is more complicated to understand than the Log4Shell vulnerability.
Today, researchers found another worst vulnerability which may cause severe damage to tonnes of applications. that can ruin the internet. At this point, there is no CVE id for this vulnerability, but Now the bug is been tracked as CVE-2022-22965, we may call it Spring4Shell. The vulnerability exists in the Spring core with the JDK version greater or equal to 9.0.
Spring Framework and derived framework spring -beans-*.jar files or CachedIntrospectionResults.class
All the details below are confirmed now shared from an Unconfirmed source. We don't take responsibility for any damage caused.
Vulnerability Details and Investigation
- It is currently known that triggering this vulnerability requires two basic conditions:
- Use the Spring MVC framework & JDK9 and above
(1). Check the JDK version number
On the running server of the organization system, run the "java -version" command to check the running JDK version. If the version number is less than or equal to 8, it is not affected by the vulnerability.
(2). Check for Spring framework usage
1. If the organization system project is deployed in the form of a war package, follow the steps below to judge.
- Unzip the war package: Change the suffix of the war file to .zip and unzip the zip file
- Search for a jar file in spring-beans-*.jar format (for example, spring-beans-5.3.16.jar) in the decompression directory. If it exists, it means that the business system is developed using the spring framework.
- If the spring-beans-*.jar file does not exist, search for the existence of the CachedIntrospectionResuLts.class file in the decompression directory. If it exists, it means that the business system is developed using the Spring framework.
2. If the organization system project runs directly and independently in the form of a jar package, judge according to the following steps.
- Unzip the jar package: Change the suffix of the jar file to .zip, and unzip the zip file.
- Search for a jar file in spring-beans-*.jar format (for example, spring-beans-5.3.16.jar) in the decompression directory. If it exists, it means that the business system is developed using the spring framework.
- If the spring-beans-*.jar file does not exist, search for the existence of the CachedIntrospectionResuLts.class file in the decompression directory. If it exists, it means that the business system is developed using the spring framework.
(3) Comprehensive Investigation
After completing the above two steps of troubleshooting, the following two conditions are met at the same time to determine that it is affected by this vulnerability:
- JDK version number is 9 and above;
- using the spring framework or derived framework.
Vulnerability Fix Guides
We have some updates, this vulnerability is much bigger than NOT as bad a Log4Shell Vulnerability. So we recommend paying attention to the release of official patches and making it apply before crooks.
WAF protection
Temporary repair measures
import org.springframework.core.annotation.Order; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.InitBinder; @ControllerAdvice @Order(10000) public class GlobalControllerAdvice{ @InitBinder public void setAllowedFields(webdataBinder dataBinder){ String[]abd=new string[]{"class.*","Class.*","*.class.*","*.Class.*"}; dataBinder.setDisallowedFields(abd); } }
From the Git Repository of Spring projects, it seems that the Spring developer is working on a fix for the remote code execution vulnerability, but we have to wait for the official confirmation.
We will update the post as we get more information on this story. You can follow us on Facebook, Twitter, and Telegram.