VDB
Sign up
CRITICAL9.8

GHSA-36p3-wjmg-h94x

Remote Code Execution in Spring Framework

Quick fix

GHSA-36p3-wjmg-h94x — org.springframework:spring-beans: upgrade to the fixed version with the command below.

# pom.xml: bump <version>5.2.20.RELEASE</version> for org.springframework:spring-beans

Details

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

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

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

Are you affected?

Enter the version of the package you're using.

Affected packages

Maven/org.springframework:spring-beans
Introduced in: 0Fixed in: 5.2.20.RELEASE
Fix# pom.xml: bump <version>5.2.20.RELEASE</version> for org.springframework:spring-beans
Maven/org.springframework:spring-beans
Introduced in: 5.3.0Fixed in: 5.3.18
Fix# pom.xml: bump <version>5.3.18</version> for org.springframework:spring-beans
Maven/org.springframework:spring-webmvc
Introduced in: 0Fixed in: 5.2.20.RELEASE
Fix# pom.xml: bump <version>5.2.20.RELEASE</version> for org.springframework:spring-webmvc
Maven/org.springframework:spring-webmvc
Introduced in: 5.3.0Fixed in: 5.3.18
Fix# pom.xml: bump <version>5.3.18</version> for org.springframework:spring-webmvc
Maven/org.springframework.boot:spring-boot-starter-web
Introduced in: 0Fixed in: 2.5.12
Fix# pom.xml: bump <version>2.5.12</version> for org.springframework.boot:spring-boot-starter-web
Maven/org.springframework.boot:spring-boot-starter-web
Introduced in: 2.6.0Fixed in: 2.6.6
Fix# pom.xml: bump <version>2.6.6</version> for org.springframework.boot:spring-boot-starter-web
Maven/org.springframework:spring-webflux
Introduced in: 0Fixed in: 5.2.20.RELEASE
Fix# pom.xml: bump <version>5.2.20.RELEASE</version> for org.springframework:spring-webflux
Maven/org.springframework:spring-webflux
Introduced in: 5.3.0Fixed in: 5.3.18
Fix# pom.xml: bump <version>5.3.18</version> for org.springframework:spring-webflux
Maven/org.springframework.boot:spring-boot-starter-webflux
Introduced in: 0Fixed in: 2.5.12
Fix# pom.xml: bump <version>2.5.12</version> for org.springframework.boot:spring-boot-starter-webflux
Maven/org.springframework.boot:spring-boot-starter-webflux
Introduced in: 2.6.0Fixed in: 2.6.6
Fix# pom.xml: bump <version>2.6.6</version> for org.springframework.boot:spring-boot-starter-webflux

References