← Lab /Security & privacy

XSS via Cloudflare /cdn-cgi/image/ by stripping CSP with Cache-Control no-cache

Security & privacy Attack · Real-world · Assetnote / Searchlight

The claim

The authors claim that an attacker can achieve cross-site scripting on any site using Cloudflare’s /cdn-cgi/image/ endpoint by exploiting an SVG sanitization bug and a Chromium Cache-Control no-cache header to remove CSP and Content-Type.

Searchlight Research Team · Assetnote / Searchlight Writeup

Published as: “Cache Me If You Can: XSS in Cloudflare's /cdn-cgi/image/”

So what

A seemingly harmless cache directive can turn image-optimization services into a same-origin XSS vector, even when strict CSPs are in place.

The five-minute version

The researchers discovered a serialization bug in the svg-hush sanitizer that allows injection of a malicious xmlns attribute. They then leveraged Chromium’s unique handling of Cache-Control: no-cache="<field-name>" to strip the Content-Security-Policy header from the cached response, bypassing a restrictive CSP. By chaining this with a Cloudflare Access logout redirect, they delivered the payload even under restrictive image source configurations. The attack was demonstrated on Cloudflare’s own domain and extended to Netlify Image CDN and S3 signed URLs, showing the broader impact.

What they found 3

What undercuts it the paper’s own results

Stated limits 2

What’s new here 4

Artifacts & methods 6

Topics

cross-site scriptingContent Security PolicyCache-ControlChromiumSVG sanitizationCloudflareimage transformationopen redirect
← Previous Unauthenticated firmware upgrade endpoint lets attackers DoS Intelbras cameras