Skip to content
Cache bugs Disclosed report Intermediate

Bypass of Cloudflare's Cache Keys and WAF via header overflow

Cloudflare's Front Line stopped evaluating cache keys and WAF rules once a request carried more than 94 headers, so an attacker could append a keyed header after the overflow to poison the cache or slip malicious content past the WAF. This could lead to cache poisoning denial of service and stored XSS.

david96 Follow with godiego and albinowax

Originally disclosed on HackerOne

  • Fixed in 2 months
  • Paid in 35 days
  • Disclosed after 8 months

Summary by the program

A limitation in our HTTP request header parsing in Front Line (FL) processing enables attackers to bypass defined rulesets. The maximum amount of headers being parsed by openresty is 100 HTTP headers including internal ones. This problem applies to any ruleset on HTTP headers. Attackers are able to bypass for instance WAF rules and perform cache forcing/poisoning. Our WAF team implemented a global rule to block, when too many headers were provided (https://developers.cloudflare.com/changelog/2025-10-20-waf-release/), which is recommended to be enabled. We want to emphasize that https://developers.cloudflare.com/ruleset-engine/rules-language/fields/reference/http.request.headers.truncated/ indicates if rulesets is not seeing all the request headers. Moreover, the length problem of parsed HTTP headers will be mitigated with the rollout of our new Front Line implementation.

Summary by the researcher

Summary

A vulnerability in HTTP request header processing allowed attackers to exploit cache poisoning attacks on all Cloudflare customers. By appending a keyed header after an overflow triggered by exceeding 94 headers, attackers could manipulate cache behavior.

  • The vulnerability enabled attackers to bypass Cloudflare’s Cache Key configuration, refer to Cloudflare Cache Key documentation. Both custom and default keyed headers were excluded from the Cache Key evaluation when the header count exceeded 94.

  • This also allowed attackers to force caching of assets not intended for caching, bypassing Cache Rules. For example, responses configured to avoid caching based on specific headers or cookies were cached.

  • When the header count surpassed 94, Cloudflare’s evaluation of Cache Rules, Custom Cache Keys, and Default Cache Keys ceased.

e.g

[94+ headers with arbitrary data]
1: 1
1: 1
1: 1
1: 1
1: 1
1: 1
X-HTTP-Method-Override: HEAD
Host: victim.com
...

Attackers could add a header initially in the cache key (e.g., X-HTTP-Method-Override) to manipulate the response and cache incorrect or malicious content to be served in subsequent responses.

This led to cache poisoning denial of service, and stored XSS attacks.

WAF Bypass

Attackers could also bypass Cloudflare’s Web Application Firewall (WAF) and both custom and managed firewall rules, allowing malicious requests to reach the origin server uninspected.

This vulnerability could be exploited to achieve stored XSS through cache poisoning and WAF bypass. For example, consider a website with a strict rule that prohibits closing tags (e.g., </tag>) and reflects the User-Agent header in its responses. The website's WAF returns a 403 error page if the request lacks the header overflow. By manipulating the User-Agent an attacker could chain these issues to poison the cache, and achieve stored XSS.

[94+ headers with arbitrary data]
1: 1
1: 1
1: 1
1: 1
1: 1
1: 1
User-Agent: </script><svg onload=alert(1)>
Host: victim.com
...

##Current Front Line (FL) Behavior:

As noted in the Cloudflare Ruleset Engine documentation, the current Front Line does not mitigate this issue. Header truncation detection (http.request.headers.truncated) is recommended to identify and block requests with excessive headers: https://developers.cloudflare.com/ruleset-engine/rules-language/fields/reference/http.request.headers.truncated/

Hi @david96, w.r.t WAF bypass - the behavior will stay like this with the current Front Line (FL): https://developers.cloudflare.com/ruleset-engine/rules-language/fields/reference/http.request.headers.truncated/ After a full migration to our new Front Line layer, WAF will have the capability to inspect/block all headers...

This report was awarded $1,250

The original report as published on HackerOne, by david96. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the HTTP header parser in Cloudflare's Front Line truncated requests at around 100 headers (including internal ones), so rulesets and cache-key evaluation never saw headers beyond that limit.

Impact

Attackers could bypass cache keys and WAF rules, leading to cache poisoning denial of service and stored XSS; the report notes the behaviour remains with the current Front Line until migration to a new layer.

What the attacker needed

Ability to send HTTP requests with many headers; target uses Cloudflare cache or WAF; victim requests the poisoned resource

The fix

Cloudflare implemented a global WAF rule to block requests with too many headers and plans to mitigate the parsing limit with a new Front Line implementation.

How it was found

  1. Send a request with more than 94 arbitrary headers to exceed the parsing limit.
  2. Append a header that is normally part of the cache key, such as X-HTTP-Method-Override, after the overflow.
  3. Observe that Cloudflare no longer evaluates cache keys or cache rules for that request.
  4. For WAF bypass, append a malicious User-Agent after the overflow so the WAF does not inspect it.
  5. Chain the cache poisoning with the reflected User-Agent to achieve stored XSS.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A web cache stores copies of pages so they load faster, and a cache key is the set of request details (like certain headers) used to decide which stored copy to serve. Cloudflare also has a firewall (WAF) that inspects requests and blocks malicious ones. The report says that if a request had more than 94 headers, Cloudflare stopped looking at the extra headers for both caching and firewall decisions, so an attacker could hide a harmful header after the cutoff and get bad content cached or a malicious request through.

What is Cache bugs?

A cache and the origin disagree about a request, so a poisoned response is served to everyone or a private page is stored as public.

More from Cloudflare Public Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Web cache poisoning and deception

The lesson behind this report.

A cache and the origin disagree about a request, so a poisoned response is served to everyone or a private page is stored as public.