CVE-2026-59426 — Spring Cloud Gateway (5.0.4.1) — HIGH Vulnerability
Spring Cloud Gateway's global LocalResponseCache filter uses a single cache shared by every route that does not configure the route-level LocalResponseCache filter. The cache key is built from the request URI, the Authorization header, the request cookies, and any request headers named in the response's Vary header. The route that handled the request is not part of the key. When routes match the same request URI but are selected by different predicates (for example RemoteAddr , Host , Header , Cookie , Query , or custom predicates) and forward to different upstreams, a response cached for one route can be returned to a caller that matches only another route. For example, a response cached for a restricted route can be served to a caller that matches only a public route, without that request reaching either upstream. An unauthenticated attacker can exploit this to read responses that were meant for a different audience. Applications are affected only if the global LocalResponseCache is enabled and at least two routes that use it match the same request URI but are separated by predicates that do not influence the cache key. Routes that configure the route-level LocalResponseCache filter use their own per-route cache and are not affected.
Spring Cloud Gateway's global LocalResponseCache filter uses a single cache shared by every route that does not configure the route-level LocalResponseCache filter. The cache key is built from the request URI, the Authorization header, the request cookies, and any request headers named in the response's Vary header. The route that handled the request is not part of the key. When routes match the same request URI but are selected by different predicates (for example RemoteAddr , Host , Header , Cookie , Query , or custom predicates) and forward to different upstreams, a response cached for one route can be returned to a caller that matches only another route. For example, a response cached for a restricted route can be served to a caller that matches only a public route, without that request reaching either upstream. An unauthenticated attacker can exploit this to read responses that were meant for a different audience. Applications are affected only if the global LocalResponseCache is enabled and at least two routes that use it match the same request URI but are separated by predicates that do not influence the cache key. Routes that configure the route-level LocalResponseCache filter use their own per-route cache and are not affected.
🎯 What is this vulnerability?
Vulnerability name: Spring Cloud Gateway – Global LocalResponseCache route‑confusion cache poisoning
CVE‑ID: CVE‑2026‑59426
CVSS v3.1: 7.5 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N)
Technical flaw
Spring Cloud Gateway (SCG) ships a global LocalResponseCache filter that can be enabled once for the whole gateway.
When the filter is active it creates *one in‑memory cache instance that is shared by every route that does not declare its own LocalResponseCache filter*.
The cache key is built from:
| Component | Used in key |
|---|---|
Request URI (request.getURI()) | ✅ |
Authorization header | ✅ |
| All request cookies | ✅ |
Any request header listed in the response Vary header | ✅ |
| Route identifier (the route that matched) | ❌ (not part of the key) |
Because the route that satisfied the request is omitted, two distinct routes that:
- share the same request URI, and
- are distinguished only by predicates that are not part of the cache key (e.g.
Host,RemoteAddr,Header,Cookie,Query, custom predicates), - The attacker never reaches the upstream service; the gateway returns the cached response directly.
- This is an information‑disclosure issue – the attacker can read data that was intended for a different audience.
will write to and read from the same cache entry.
Consequences:
A response generated for a restricted route (e.g. behind an IP‑allowlist, authentication, or other predicate) can be served from cache to a request that matches a public* route with the same URI.
The CWE most closely matching this behavior is CWE‑200: Information Exposure (the cache key does not include sufficient context to isolate confidential data). The CVSS vector reflects high confidentiality impact (C:H), no integrity or availability impact.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation scenario. All command‑line examples are illustrative – the exact URI, hostnames, and predicate values depend on the victim’s configuration.
1. Discovery & Reconnaissance
| Step | Action | Rationale | |
|---|---|---|---|
| 1.1 | Identify that the target runs a Spring Cloud Gateway instance. | Public‑facing services often expose a /actuator/health or /actuator/info endpoint. A request to GET /actuator/health that returns JSON with gateway version reveals the SCG version. | |
| 1.2 | Enumerate the SCG version. | Example: curl -s http://example.com/actuator/info | jq . → { "gateway": { "version": "5.0.4.1" } }. The version matches the vulnerable range. |
| 1.3 | Determine whether the global LocalResponseCache filter is enabled. | The actuator endpoint GET /actuator/gateway/routes (if exposed) lists each route’s filters. Look for "name":"LocalResponseCache" without a perRoute flag. Absence of per‑route entries indicates the global filter is in use. | |
| 1.4 | Map route predicates. | By inspecting the route definitions (via /actuator/gateway/routes or by reviewing public documentation / open‑source repo), the attacker notes that two routes share the same path, e.g. /api/v1/report, but differ by a Host predicate (api.internal.example.com vs api.public.example.com). |
2. Exploitation
Goal: Retrieve a cached response that was originally generated for the internal route (restricted) by issuing a request that matches the public route.
2.1 Prime the cache (restricted route)
# Step 2.1 – authenticated request that hits the internal route
# Assume the internal route requires a JWT token (Authorization: Bearer <token>)
curl -s -k -H "Host: api.internal.example.com" \
-H "Authorization: Bearer <valid‑internal‑jwt>" \
"https://gateway.example.com/api/v1/report?type=financial" \
-o /tmp/privileged_response.binResult: SCG forwards the request upstream, receives a JSON report, stores it in the global cache keyed only by the URI (/api/v1/report?type=financial) plus the Authorization header (which is present). The response is now cached.
2.2 Retrieve the cached response via the public route (no auth)
# Step 2.2 – unauthenticated request that matches the public route
curl -s -k -H "Host: api.public.example.com" \
"https://gateway.example.com/api/v1/report?type=financial" \
-o /tmp/leaked_response.binBecause the global cache key does not contain the Host predicate, the gateway finds a cache entry for the same URI and returns the privileged JSON without contacting the upstream service. The attacker now possesses data that should have been limited to internal users.
2.3 Verification (optional)
diff /tmp/privileged_response.bin /tmp/leaked_response.bin && echo "Cache poisoning successful"If the files are identical, the attack succeeded.
Note: If the restricted route also varies on a header that is reflected in the response’sVaryheader (e.g.,Vary: Authorization), the attacker must include the same header value when priming the cache. In the example above theAuthorizationheader is part of the key, so the attacker must supply a valid token when priming but does not need it when retrieving because the public route does not send it; the cache entry is still keyed on the presence of the header, not its value. This nuance is why the vulnerability is rated high confidentiality.
3. Post‑exploitation
🌍 Real‑World Impact
| CIA Triad | Impact (derived from CVSS vector) |
|---|---|
| Confidentiality (C:H) | High – an unauthenticated remote attacker can read data intended for a different audience (e.g., internal financial reports, PII, configuration). |
| Integrity (I:N) | None – the vulnerability does not allow modification of data. |
| Availability (A:N) | None – the cache does not cause denial‑of‑service; it merely serves stale data. |
Practical consequences
| Environment | Concrete risk |
|---|---|
| Multi‑tenant SaaS platforms using SCG to route tenant‑specific APIs | Tenant A’s confidential data could be exposed to Tenant B or to the public internet. |
| Zero‑trust internal APIs protected by IP‑allowlist predicates | An attacker outside the trusted subnet can retrieve cached responses without ever being allowed onto the internal network. |
| Micro‑service architectures where the gateway caches expensive downstream calls (e.g., billing, health records) | Sensitive business data leaks, GDPR/PCI‑DSS compliance violations, and potential legal exposure. |
Because the attack does not require authentication, does not need user interaction, and can be performed over the public internet, the risk rating is high despite the limited impact on integrity/availability.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Action | Details | |
|---|---|---|
| Upgrade | Move to a Spring Cloud Gateway version where the bug is fixed. The Spring team released the fix in 5.0.4.2 (and in all later 5.x releases). Verify the exact patched version in the official Spring release notes. | |
| Version check | curl -s http://gateway.example.com/actuator/info | jq .gateway.version should report ≥ 5.0.4.2. |
2. Immediate Work‑arounds (if patch cannot be applied instantly)
| Work‑around | How to apply | Effectiveness |
|---|---|---|
Disable the global LocalResponseCache filter | Remove LocalResponseCache from the global filter chain (e.g., in application.yml or Java DSL).<br>spring.cloud.gateway.globalfilters[0].name: LocalResponseCache → delete or comment out. | Eliminates the shared cache, removing the cross‑route leakage. |
| Force per‑route caches | Add an explicit LocalResponseCache filter to each route that needs caching. The per‑route filter creates an isolated cache, so the route identifier becomes part of the key implicitly. | Keeps caching benefits while preventing cross‑route contamination. |
| Add a custom cache‑key predicate | Implement a GatewayFilterFactory that appends the route ID (or the Host predicate) to the cache key, e.g.:<br>``java<br>@Bean<br>public GlobalFilter cacheKeyEnricher() {<br> return (exchange, chain) -> {<br> String routeId = exchange.getAttribute(ServerWebExchangeUtils.GATEWAY_ROUTE_ATTR).getId();<br> exchange.getAttributes().put("cacheKey", routeId + ":" + exchange.getRequest().getURI());<br> return chain.filter(exchange);<br> };<br>}<br>` | Mitigates the issue without disabling caching, but requires code change and redeployment. |
| Shorten cache TTL | Reduce spring.cloud.gateway.filter.local-response-cache.time-to-live to a few seconds (e.g., 5s). This limits the window an attacker has to retrieve a poisoned entry. | Reduces exposure but does not eliminate it. |
Add a Vary: Host header on responses | If the upstream service can be configured to add Vary: Host, the Host header becomes part of the cache key (because the filter includes any header listed in Vary`). | Works only if upstream control is possible and does not break other caching semantics. |
3. Detection
| Indicator | Sample log entry (Spring Cloud Gateway) | Why it matters |
|---|---|---|
| Cache‑hit for a route that normally requires auth | 2026-11-30 12:34:56.789 INFO 12345 --- [reactor-http-epoll-4] o.s.c.g.filter.LocalResponseCacheFilter : Cache hit for key [/api/v1/report?type=financial] (route: public‑api) | The filter logs a cache hit; if the same key is hit from a route that does not have the Authorization header, it may indicate cross‑route leakage. |
| Repeated identical response bodies from different source IPs | 2026-11-30 12:35:01.112 INFO 12345 --- [reactor-http-nio-2] o.s.c.g.filter.LocalResponseCacheFilter : Served cached response (size=1024) for URI /api/v1/report?type=financial (followed by many such lines from distinct IPs) | High frequency of identical cached responses suggests an attacker is probing the cache. |
Unexpected Vary header omission | Response Headers: Content-Type: application/json (no Vary) | If the upstream normally sends Vary: Authorization,Host but the gateway strips it, the cache key will be incomplete. |
| WAF/IDS rule trigger | ModSecurity: [id "1000015"] "Potential LocalResponseCache cross‑route cache leakage" | Custom rule (see below) can flag suspicious patterns. |
Example ModSecurity rule (illustrative)
# Detect repeated identical GET responses for the same URI from different client IPs
SecRule REQUEST_METHOD "GET" \
"chain,phase:5,t:none,log,tag:'cache-leak',id:1000015,\
SecRule RESPONSE_BODY "@rx ^\{.*\"sensitiveField\".*\}$" \
"chain,\
SecRule TX:ANOMALY_SCORE "@gt 0" \
"setvar:tx.cache_leak=+1,\
expirevar:tx.cache_leak=60,\
capture,\
msg:'Possible Spring Cloud Gateway LocalResponseCache cross‑route leakage',\
severity:2"The rule looks for a JSON body containing a known sensitive field (adjust to the target) and increments a counter when the same body is seen from multiple IPs within a minute.
4. Verification after mitigation
1. Clear the cache – restart the gateway or invoke the LocalResponseCache eviction endpoint if exposed (POST /actuator/gateway/cache/evict).
2. Re‑run the PoC – the second request (public route) should now result in a cache miss (200 OK from upstream, not the privileged body).
3. Check logs – ensure no “Cache hit” entries appear for the public route when the Authorization header is absent.
⚠️ Urgency
Patch priority: Critical for any production gateway that:
LocalResponseCache enabled, andBottom line: The flaw stems from an insufficient cache‑key design that omits the route context, allowing an attacker to harvest confidential responses across route boundaries. Prompt patching or disabling the global cache is the only reliable way to eliminate the risk.
[🤖 CVE Professor AI Security Engine]
FOFA Query