Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS0zNnAzLXdqbWctaDk0eM03aQ

Remote Code Execution in Spring Framework

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:

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).

Permalink: https://github.com/advisories/GHSA-36p3-wjmg-h94x
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0zNnAzLXdqbWctaDk0eM03aQ
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Critical
Classification: General
Published: over 1 year ago
Updated: 10 months ago


CVSS Score: 9.8
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Identifiers: GHSA-36p3-wjmg-h94x, CVE-2022-22965
References:

Affected Packages

maven:org.springframework:spring-webflux
Versions: < 5.2.20.RELEASE, >= 5.3.0, < 5.3.18
Fixed in: 5.2.20.RELEASE, 5.3.18
maven:org.springframework:spring-webmvc
Versions: < 5.2.20.RELEASE, >= 5.3.0, < 5.3.18
Fixed in: 5.2.20.RELEASE, 5.3.18
maven:org.springframework:spring-beans
Versions: < 5.2.20.RELEASE, >= 5.3.0, < 5.3.18
Fixed in: 5.2.20.RELEASE, 5.3.18
maven:org.springframework.boot:spring-boot-starter-webflux
Versions: >= 2.6.0, < 2.6.6, < 2.5.12
Fixed in: 2.6.6, 2.5.12
maven:org.springframework.boot:spring-boot-starter-web
Versions: >= 2.6.0, < 2.6.6, < 2.5.12
Fixed in: 2.6.6, 2.5.12