Lucene search

K
githubGitHub Advisory DatabaseGHSA-36P3-WJMG-H94X
HistoryMar 31, 2022 - 6:30 p.m.

Remote Code Execution in Spring Framework

2022-03-3118:30:50
CWE-74
CWE-94
GitHub Advisory Database
github.com
1331
spring framework
remote code execution
spring4shell
jdk 9+
apache tomcat
war deployment
spring boot
spring-webmvc
spring-webflux
patches
workarounds
webdatabinder
controlleradvice
requestmappinghandleradapter
webmvcregistrations
webfluxregistrations

CVSS2

7.5

Attack Vector

NETWORK

Attack Complexity

LOW

Authentication

NONE

Confidentiality Impact

PARTIAL

Integrity Impact

PARTIAL

Availability Impact

PARTIAL

AV:N/AC:L/Au:N/C:P/I:P/A:P

CVSS3

9.8

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

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

EPSS

0.975

Percentile

100.0%

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 configurations

Vulners
Node
org.springframeworkspring-webfluxRange<5.2.20.RELEASE
OR
org.springframeworkspring-webmvcRange<5.2.20.RELEASE
OR
org.springframeworkspring-beansRange<5.2.20.RELEASE
OR
org.springframework.bootspring-boot-starter-webfluxRange2.6.02.6.6
OR
org.springframework.bootspring-boot-starter-webfluxRange<2.5.12
OR
org.springframeworkspring-webfluxRange5.3.05.3.18
OR
org.springframework.bootspring-boot-starter-webRange2.6.02.6.6
OR
org.springframework.bootspring-boot-starter-webRange<2.5.12
OR
org.springframeworkspring-webmvcRange5.3.05.3.18
OR
org.springframeworkspring-beansRange5.3.05.3.18
VendorProductVersionCPE
org.springframeworkspring-webflux*cpe:2.3:a:org.springframework:spring-webflux:*:*:*:*:*:*:*:*
org.springframeworkspring-webmvc*cpe:2.3:a:org.springframework:spring-webmvc:*:*:*:*:*:*:*:*
org.springframeworkspring-beans*cpe:2.3:a:org.springframework:spring-beans:*:*:*:*:*:*:*:*
org.springframework.bootspring-boot-starter-webflux*cpe:2.3:a:org.springframework.boot:spring-boot-starter-webflux:*:*:*:*:*:*:*:*
org.springframework.bootspring-boot-starter-web*cpe:2.3:a:org.springframework.boot:spring-boot-starter-web:*:*:*:*:*:*:*:*

References

CVSS2

7.5

Attack Vector

NETWORK

Attack Complexity

LOW

Authentication

NONE

Confidentiality Impact

PARTIAL

Integrity Impact

PARTIAL

Availability Impact

PARTIAL

AV:N/AC:L/Au:N/C:P/I:P/A:P

CVSS3

9.8

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

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

EPSS

0.975

Percentile

100.0%