Skip to content
Cache bugs Write-up Advanced

Instant-loading websites gone wrong: Debugging a SXG cache poisoning bug

A hidden cache in Cloudflare's Signed Exchange (SXG) system stored integrity hashes for subresources, and when those subresources changed (e.g., due to new ETags after deployments), the cache became poisoned, causing Google's SXG cache to serve pages with mismatched integrity hashes. This led to prefetching errors and broken SXG experiences for users.

blog.pawelpokrywka.com

Published on blog.pawelpokrywka.com

Performance

Paweł Pokrywka, on blog.pawelpokrywka.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

How it worked

Root cause

Likely the hidden ASX cache stored integrity hashes of subresources and did not update them when the subresources mutated (e.g., due to ETag changes from deployments), leading to a mismatch between the cached hash and the actual subresource.

Impact

This could cause prefetching errors and CORS errors, breaking the SXG experience for end users, and the issue persisted because the hidden cache could not be purged.

What the attacker needed

Cloudflare SXG enabled; Frequent deployments changing ETags; Google SXG cache involved

The fix

The issue was fixed by eliminating subresource mutation, specifically by disabling or removing the ETag header for static assets, and regenerating URLs to invalidate the hidden cache.

How it was found

  1. Fetch the problematic SXG-wrapped page with dump-signedexchange and note the header-integrity hash for a subresource.
  2. Fetch the same subresource with dump-signedexchange and compare its header integrity hash.
  3. Fetch the Google-cached version of the page and observe a different header-integrity hash.
  4. Use Google Search Console's URL inspection tool to see the headers Googlebot receives, confirming the mismatch.
  5. Use a VPN to connect to the same Cloudflare data center as Googlebot (e.g., Chicago) and fetch the SXG page to reproduce the issue.
  6. Purge the Cloudflare cache and test again to rule out the normal cache, leading to the discovery of a hidden ASX cache.

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 write-up has not been written yet. The Original tab links to the source.

Signed Exchanges (SXG) is a web technology that lets a page be served from a cache while appearing to come from the original site. A hidden cache stored the fingerprints (integrity hashes) of subresources like CSS files, but when those files changed slightly (e.g., due to new ETags after deployments), the cache kept the old fingerprints, causing errors when browsers tried to load the page.

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.

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.