Spring Cloud Gateway cached private responses when headers used more than one directive
Spring Cloud Gateway's LocalResponseCache could store a response that explicitly prohibited caching. CVE-2026-59427 explains the cause: the filter compared the entire Cache-Control value with the strings private and no-store instead of parsing the header's comma-separated directives. Values such as private, no-store therefore missed both checks.
Affected deployments
The listed ranges are 5.0.0 through 5.0.4, 4.3.0 through 4.3.6, and 4.0.0 through 4.2.10. Spring identifies 5.0.5 as the open-source fix and lists enterprise-only fixes for the older branches.
Exposure depends on more than the Gateway version. The route must enable LocalResponseCache, forward to an upstream that returns user-specific content, and receive a Cache-Control header containing more than one directive. The upstream also must not separate callers with an appropriate Vary header.
Why a cache hit becomes an authorization problem
When the response is stored, a later request can receive it without reaching the upstream service. The advisory states that an unauthenticated attacker can then read content intended for an authenticated user. The vulnerable component is the cache decision, but the consequence belongs to the application's authorization model.
A response marked private, no-store should never enter a shared route cache. The combined header is normal, especially from frameworks that add several cache directives. Code that checks for an exact string will work in simple tests and fail on production headers.
Remediation
Upgrade to a fixed Spring Cloud Gateway release. Inventory every route with LocalResponseCache enabled and identify whether it carries authenticated or tenant-specific responses. For those routes, confirm the upstream sends a correct Cache-Control policy and a Vary header when representations differ by credentials, cookies, locale, or another request property.
Cache invalidation is part of the response. Remove entries created before the upgrade and make sure the rollout completes on every replica. A mixed fleet leaves older nodes able to store and serve the same private response.
Test the behavior with the exact header shapes expected in production. Include combined directives, mixed case, spacing, and multiple Cache-Control headers. Do not rely only on a unit test that passes the literal private or no-store.
Operational checks
- Confirm every Gateway instance runs a fixed version.
- List routes where response caching is intentionally enabled.
- Verify private and authenticated responses cannot enter a shared cache.
- Review access logs for cache hits whose user or tenant identity changes.
- Invalidate pre-fix entries before declaring the issue closed.
Top comments (0)