CVE-2026-59428
Patch Available.
This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.
Overview
Spring Cloud Gateway is an API gateway built on top of the Spring ecosystem. It provides a simple, effective way to route requests to backend services and to apply cross-cutting concerns such as security, monitoring and resiliency to them.
An incorrectly configured access control vulnerability (CVE-2026-59428) has been identified in the WebSocket routing filter of Spring Cloud Gateway, which allows attackers to open a WebSocket connection through the gateway to a backend service from a malicious web page, using the victim's cookies. This is a form of Cross-Site WebSocket Hijacking, which can expose the data the backend sends over the socket and let the attacker send messages as the victim.
Per OWASP: Cross-Site Request Forgery (CSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated.
This issue affects multiple versions of Spring Cloud Gateway.
Details
Module Info
- Product: Spring Cloud Gateway
- Affected packages:
org.springframework.cloud:spring-cloud-gateway-server,org.springframework.cloud:spring-cloud-gateway-server-webflux - Affected versions:
org.springframework.cloud:spring-cloud-gateway-server: >=3.1.0 <=3.1.14, >=4.2.0 <=4.2.10, >=4.3.0 <=4.3.6org.springframework.cloud:spring-cloud-gateway-server-webflux: >=5.0.0 <=5.0.4
- GitHub repository: https://github.com/spring-cloud/spring-cloud-gateway
- Published packages:
- Package manager: Maven
- Fixed in:
- OSS Spring Cloud Gateway 5.0.5
- NES for Spring Cloud Gateway
Vulnerability Info
This Medium-severity vulnerability is found in the spring-cloud-gateway-server and spring-cloud-gateway-server-webflux packages in multiple versions of Spring Cloud Gateway. Applications are affected only if they expose a route with a ws or wss URI through the gateway.
Browsers do not apply the same-origin policy or CORS to WebSocket handshakes. They send the Origin header with the handshake and rely on the server to accept or reject it. WebsocketRoutingFilter never reads that header. Once a request resolves to a ws or wss route URL, the filter hands it straight to the WebSocket service and starts proxying:
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
changeSchemeIfIsWebSocketUpgrade(exchange);
URI requestUrl = exchange.getRequiredAttribute(GATEWAY_REQUEST_URL_ATTR);
String scheme = requestUrl.getScheme();
if (isAlreadyRouted(exchange) || (!"ws".equals(scheme) && !"wss".equals(scheme))) {
return chain.filter(exchange);
}
setAlreadyRouted(exchange);
HttpHeaders headers = exchange.getRequest().getHeaders();
HttpHeaders filtered = filterRequest(getHeadersFilters(), exchange);
List<String> protocols = getProtocols(headers);
return this.webSocketService.handleRequest(exchange,
new ProxyWebSocketHandler(requestUrl, this.webSocketClient, filtered, protocols));
}The header filters the gateway applies here remove only the Host header, the Sec-WebSocket-* headers and hop-by-hop headers, so the Cookie header the browser attached to the handshake is forwarded to the backend when ProxyWebSocketHandler opens the upstream connection. A page on any origin that the victim visits can therefore run new WebSocket("wss://gateway.example.com/ws-route"). The gateway accepts the cross-origin handshake and connects to the backend with the victim's session. The attacker's script can then read every message the backend sends and send messages of its own in the victim's name.
Mitigation
Only recent versions of Spring Cloud Gateway receive community support. Older lines are End-of-Life and will not receive public updates to address this issue.
Users of the affected components should apply one of the following mitigations:
- Upgrade to a currently supported version of Spring Cloud Gateway.
- Leverage a commercial support partner like HeroDevs for post-EOL security support.