Remote Code Execution in Spring Framework
Published 31 Mar 2022 · Updated 22 Oct 2025
Is your project on an affected org.springframework:spring-beans?
Look after several Java apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected packages
- Affected
- <5.2.20.RELEASE
- Fixed in
- 5.2.20.RELEASE
mvn versions:use-dep-version -Dincludes=org.springframework:spring-beans -DdepVersion=5.2.20.RELEASE -DforceVersion=true- Affected
- >=5.3.0 <5.3.18
- Fixed in
- 5.3.18
mvn versions:use-dep-version -Dincludes=org.springframework:spring-beans -DdepVersion=5.3.18 -DforceVersion=true- Affected
- <5.2.20.RELEASE
- Fixed in
- 5.2.20.RELEASE
mvn versions:use-dep-version -Dincludes=org.springframework:spring-webmvc -DdepVersion=5.2.20.RELEASE -DforceVersion=true- Affected
- >=5.3.0 <5.3.18
- Fixed in
- 5.3.18
mvn versions:use-dep-version -Dincludes=org.springframework:spring-webmvc -DdepVersion=5.3.18 -DforceVersion=true- Affected
- <2.5.12
- Fixed in
- 2.5.12
mvn versions:use-dep-version -Dincludes=org.springframework.boot:spring-boot-starter-web -DdepVersion=2.5.12 -DforceVersion=true- Affected
- >=2.6.0 <2.6.6
- Fixed in
- 2.6.6
mvn versions:use-dep-version -Dincludes=org.springframework.boot:spring-boot-starter-web -DdepVersion=2.6.6 -DforceVersion=true- Affected
- <5.2.20.RELEASE
- Fixed in
- 5.2.20.RELEASE
mvn versions:use-dep-version -Dincludes=org.springframework:spring-webflux -DdepVersion=5.2.20.RELEASE -DforceVersion=true- Affected
- >=5.3.0 <5.3.18
- Fixed in
- 5.3.18
mvn versions:use-dep-version -Dincludes=org.springframework:spring-webflux -DdepVersion=5.3.18 -DforceVersion=true- Affected
- <2.5.12
- Fixed in
- 2.5.12
mvn versions:use-dep-version -Dincludes=org.springframework.boot:spring-boot-starter-webflux -DdepVersion=2.5.12 -DforceVersion=true- Affected
- >=2.6.0 <2.6.6
- Fixed in
- 2.6.6
mvn versions:use-dep-version -Dincludes=org.springframework.boot:spring-boot-starter-webflux -DdepVersion=2.6.6 -DforceVersion=trueDetails
Spring Framework prior to versions 5.2.20 and 5.3.18 contains a remote code execution vulnerability known as Spring4Shell.
Impact
A Spring MVC or Spring WebFlux application running on JDK 9+ may be vulnerable to remote code execution (RCE) via data binding. The specific exploit requires the application to run on Tomcat as a WAR deployment. If the application is deployed as a Spring Boot executable jar, i.e. the default, it is not vulnerable to the exploit. However, the nature of the vulnerability is more general, and there may be other ways to exploit it.
These are the prerequisites for the exploit:
- JDK 9 or higher
- Apache Tomcat as the Servlet container
- Packaged as WAR
spring-webmvcorspring-webfluxdependency
Patches
Workarounds
For those who are unable to upgrade, leaked reports recommend setting disallowedFields on WebDataBinder through an @ControllerAdvice. This works generally, but as a centrally applied workaround fix, may leave some loopholes, in particular if a controller sets disallowedFields locally through its own @InitBinder method, which overrides the global setting.
To apply the workaround in a more fail-safe way, applications could extend RequestMappingHandlerAdapter to update the WebDataBinder at the end after all other initialization. In order to do that, a Spring Boot application can declare a WebMvcRegistrations bean (Spring MVC) or a WebFluxRegistrations bean (Spring WebFlux).
Is GHSA-36p3-wjmg-h94x in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected org.springframework:spring-beans, and gives you the command that fixes it.
More advisories for org.springframework:spring-beans
- HighCVE-2022-22970Denial of service in Spring Framework · 13 May 2022
References
- Advisorynvd.nist.gov/vuln/detail/CVE-2022-22965
- Linkgithub.com/spring-projects/spring-framework/commit/002546b3e4b8d791ea6acccb81eb3168f51abb15
- Linkcert-portal.siemens.com/productcert/pdf/ssa-254054.pdf
- Linkgithub.com/spring-projects/spring-boot/releases/tag/v2.5.12
- Linkgithub.com/spring-projects/spring-boot/releases/tag/v2.6.6
- Packagegithub.com/spring-projects/spring-framework
- Linkgithub.com/spring-projects/spring-framework/releases/tag/v5.2.20.RELEASE
- Linkgithub.com/spring-projects/spring-framework/releases/tag/v5.3.18
- Linkpsirt.global.sonicwall.com/vuln-detail/SNWLID-2022-0005
- Linkspring.io/blog/2022/03/31/spring-framework-rce-early-announcement
- Linktanzu.vmware.com/security/cve-2022-22965
- Linktools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-java-spring-rce-Zx9GUc67
- Linkwww.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2022-22965
- Linkwww.kb.cert.org/vuls/id/970766
- Linkwww.oracle.com/security-alerts/cpuapr2022.html
- Linkwww.oracle.com/security-alerts/cpujul2022.html
- Linkpacketstormsecurity.com/files/166713/Spring4Shell-Code-Execution.html
- Linkpacketstormsecurity.com/files/167011/Spring4Shell-Spring-Framework-Class-Property-Remote-Code-Execution.html
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.