A newly disclosed cache poisoning technique dubbed cache key injection can enable attackers to bypass access controls, expose cached sensitive content, trigger denial-of-service conditions, and potentially plant stored cross-site scripting payloads in vulnerable Nginx deployments.
The research, published by YesWeHack researcher Alex Brumen, shifts attention away from traditional web cache poisoning flaws involving unkeyed HTTP input.
Instead, it targets the construction of the cache key itself, particularly configurations that concatenate multiple variable-length request components without delimiters.
New Cache Key Injection Attack

Web caches store HTTP responses under keys assembled from selected request properties, often including the scheme, host, URI, query string, cookies, or headers. Nginx deployments may use a configuration resembling:
proxy_cache_key "$scheme$proxy_host$uri$is_args$args$http_accept";
The danger is not that the resulting string is unhashed. Rather, it is that adjacent values are merged ambiguously.
Yeswehack stated that two distinct requests can produce an identical final key when an attacker shifts characters between controllable fragments such as the URL path and the Accept header.
For example, a legitimate request for / with Accept: */* can generate the same final key as a request for /* with Accept: /*, depending on the remaining key components.
If the latter request causes Nginx to cache an attacker-influenced response, later requests for the legitimate resource may receive that poisoned content.

The technique can have serious consequences where a globally shared cache sits in front of protected application routes. In the proof of concept, an administrator’s localhost-only request for /admin is first cached. An external attacker cannot request /admin directly because Nginx’s access-control list blocks it.
However, the attacker can request a different, permitted path while supplying the missing portion of the protected route in an adjacent cache-key component.
If the crafted request collides with the previously cached /admin response, Nginx may serve the restricted dashboard from cache without evaluating access restrictions for the original protected route. This creates a web cache deception scenario that requires no interaction from a victim.
Researchers also demonstrated cache-poisoned denial of service, or CPDoS. An attacker can force a request for a nonexistent path to collide with the cache key for a valid page such as /home.
If Nginx stores the resulting 404 response, normal visitors can receive the cached error page instead of the real resource until expiry or purge. A more complex variation abuses the $scheme$host$request_uri pattern.
If an application accepts manipulated Host headers, serves equivalent HTTP and HTTPS content, and reflects the host into a cacheable script source, an attacker may create a collision between HTTP and HTTPS cache entries.
The poisoned response could reference attacker-controlled JavaScript, turning the issue into stored XSS.
Mitigation
Organizations should audit custom Nginx proxy_cache_key directives and avoid concatenating raw variable-length values without clear boundaries.
Adding separators or using structured encoding preserves the identity of each component; for example, "$scheme|$host|$request_uri|$http_accept" eliminates ambiguity between adjacent fragments.
Defenders should also prevent caching of authenticated or access-controlled responses, strictly validate Host headers, redirect HTTP to HTTPS, and ensure CDN and origin-cache behavior is consistent.
The research further warns that a Cloudflare edge cache can be bypassed with an Authorization header under some configurations, allowing attackers to target a downstream Nginx origin cache directly.
Join 16,000+ SOC teams using ANY.RUN to streamline threat investigations and reduce manual effort. Explore for your team