ghsa-36p3-wjmg-h94x
Vulnerability from github
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-webmvc
or spring-webflux
dependency
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).
{ "affected": [ { "package": { "ecosystem": "Maven", "name": "org.springframework:spring-beans" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "5.2.20.RELEASE" } ], "type": "ECOSYSTEM" } ] }, { "package": { "ecosystem": "Maven", "name": "org.springframework:spring-beans" }, "ranges": [ { "events": [ { "introduced": "5.3.0" }, { "fixed": "5.3.18" } ], "type": "ECOSYSTEM" } ] }, { "package": { "ecosystem": "Maven", "name": "org.springframework:spring-webmvc" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "5.2.20.RELEASE" } ], "type": "ECOSYSTEM" } ] }, { "package": { "ecosystem": "Maven", "name": "org.springframework:spring-webmvc" }, "ranges": [ { "events": [ { "introduced": "5.3.0" }, { "fixed": "5.3.18" } ], "type": "ECOSYSTEM" } ] }, { "package": { "ecosystem": "Maven", "name": "org.springframework.boot:spring-boot-starter-web" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "2.5.12" } ], "type": "ECOSYSTEM" } ] }, { "package": { "ecosystem": "Maven", "name": "org.springframework.boot:spring-boot-starter-web" }, "ranges": [ { "events": [ { "introduced": "2.6.0" }, { "fixed": "2.6.6" } ], "type": "ECOSYSTEM" } ] }, { "package": { "ecosystem": "Maven", "name": "org.springframework:spring-webflux" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "5.2.20.RELEASE" } ], "type": "ECOSYSTEM" } ] }, { "package": { "ecosystem": "Maven", "name": "org.springframework:spring-webflux" }, "ranges": [ { "events": [ { "introduced": "5.3.0" }, { "fixed": "5.3.18" } ], "type": "ECOSYSTEM" } ] }, { "package": { "ecosystem": "Maven", "name": "org.springframework.boot:spring-boot-starter-webflux" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "2.5.12" } ], "type": "ECOSYSTEM" } ] }, { "package": { "ecosystem": "Maven", "name": "org.springframework.boot:spring-boot-starter-webflux" }, "ranges": [ { "events": [ { "introduced": "2.6.0" }, { "fixed": "2.6.6" } ], "type": "ECOSYSTEM" } ] } ], "aliases": [ "CVE-2022-22965" ], "database_specific": { "cwe_ids": [ "CWE-74", "CWE-94" ], "github_reviewed": true, "github_reviewed_at": "2022-03-31T18:30:50Z", "nvd_published_at": "2022-04-01T23:15:00Z", "severity": "CRITICAL" }, "details": "Spring Framework prior to versions 5.2.20 and 5.3.18 contains a remote code execution vulnerability known as `Spring4Shell`. \n\n## Impact\n\nA 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.\n\nThese are the prerequisites for the exploit:\n- JDK 9 or higher\n- Apache Tomcat as the Servlet container\n- Packaged as WAR\n- `spring-webmvc` or `spring-webflux` dependency\n\n## Patches\n\n- Spring Framework [5.3.18](https://github.com/spring-projects/spring-framework/releases/tag/v5.3.18) and [5.2.20](https://github.com/spring-projects/spring-framework/releases/tag/v5.2.20.RELEASE)\n- Spring Boot [2.6.6](https://github.com/spring-projects/spring-boot/releases/tag/v2.6.6) and [2.5.12](https://github.com/spring-projects/spring-boot/releases/tag/v2.5.12)\n\n## Workarounds\n\nFor 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.\n\nTo 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).", "id": "GHSA-36p3-wjmg-h94x", "modified": "2022-06-01T22:15:49Z", "published": "2022-03-31T18:30:50Z", "references": [ { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-22965" }, { "type": "WEB", "url": "https://github.com/spring-projects/spring-framework/commit/002546b3e4b8d791ea6acccb81eb3168f51abb15" }, { "type": "WEB", "url": "https://cert-portal.siemens.com/productcert/pdf/ssa-254054.pdf" }, { "type": "WEB", "url": "https://github.com/spring-projects/spring-boot/releases/tag/v2.5.12" }, { "type": "WEB", "url": "https://github.com/spring-projects/spring-boot/releases/tag/v2.6.6" }, { "type": "PACKAGE", "url": "https://github.com/spring-projects/spring-framework" }, { "type": "WEB", "url": "https://github.com/spring-projects/spring-framework/releases/tag/v5.2.20.RELEASE" }, { "type": "WEB", "url": "https://github.com/spring-projects/spring-framework/releases/tag/v5.3.18" }, { "type": "WEB", "url": "https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2022-0005" }, { "type": "WEB", "url": "https://spring.io/blog/2022/03/31/spring-framework-rce-early-announcement" }, { "type": "WEB", "url": "https://tanzu.vmware.com/security/cve-2022-22965" }, { "type": "WEB", "url": "https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-java-spring-rce-Zx9GUc67" }, { "type": "WEB", "url": "https://www.oracle.com/security-alerts/cpuapr2022.html" }, { "type": "WEB", "url": "https://www.oracle.com/security-alerts/cpujul2022.html" }, { "type": "WEB", "url": "http://packetstormsecurity.com/files/166713/Spring4Shell-Code-Execution.html" }, { "type": "WEB", "url": "http://packetstormsecurity.com/files/167011/Spring4Shell-Spring-Framework-Class-Property-Remote-Code-Execution.html" } ], "schema_version": "1.4.0", "severity": [ { "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "type": "CVSS_V3" } ], "summary": "Remote Code Execution in Spring Framework" }
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.