CSRF Attack via CORS Preflight Requests with Spring MVC or Spring WebFlux
Spring Framework
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| org.springframework:spring-webmvc Maven |
|
|
| org.springframework:spring-webflux Maven |
|
|
Spring Framework
| Product | Affected | Fixed in |
|---|---|---|
| org.springframework:spring-webmvc Maven |
|
|
| org.springframework:spring-webflux Maven |
|
|
Spring Framework, versions 5.2.x prior to 5.2.3 are vulnerable to CSRF attacks through CORS preflight requests that target Spring MVC (spring-webmvc module) or Spring WebFlux (spring-webflux module) endpoints. Only non-authenticated endpoints are vulnerable because preflight requests should not include credentials and therefore requests should fail authentication. However a notable exception to this are Chrome based browsers when using client certificates for authentication since Chrome sends TLS client certificates in CORS preflight requests in violation of spec requirements. No HTTP body can be sent or received as a result of this attack.
From the CVE record · pivotal
Spring MVC and Spring WebFlux endpoints are vulnerable to CSRF through CORS preflight requests. The attack affects non-authenticated endpoints; Chrome-based browsers using client certificates are an exception because they send certificates with preflight requests. The attack cannot send or receive an HTTP body.
Teams running Maven org.springframework:spring-webmvc or org.springframework:spring-webflux versions 5.2.0 through 5.2.2 should check their deployments.