XSS via Cloudflare /cdn-cgi/image/
Attack Techniques & Methods2026-11-05, 07:46
XSS via Cloudflare /cdn-cgi/image/
Searchlight Cyber researchers demonstrated how to achieve XSS through Cloudflare’s built-in image transformation handler. The exploit chain combines an SVG sanitizer bypass, a Chromium behavior involving the
Cache-Control: no-cache directive, and an open-redirect chain in the Cloudflare Access infrastructure.
The issue is not limited to Cloudflare: the same technique using Cache-Control also worked on Netlify Image CDN and on object storage accessible via signed URLs.Attack components:
• Bypassing
svg-hush. Ordinary attribute values are escaped, while namespace declaration values are inserted unescaped during serialization. By abusing the xmlns value, it is possible to break out of the attribute and inject script, which the sanitizer no longer checks.
• Removing CSP from the Chromium cache. Cloudflare forwards the Cache-Control header from the origin response. The no-cache="Content-Security-Policy" directive causes Chromium to store the response body in the HTTP cache while excluding the CSP header from the cached copy. On subsequent navigation, the page loads without the security policy.
• Bypassing image source restrictions. The /cdn-cgi/image/ loader follows redirects without checking whether the final destination is allowed. If Cloudflare Access is enabled on any hostname in the zone, /cdn-cgi/access/logout accepts a returnTo parameter and allows redirects to cloudflare.com subdomains. One of them contained an open redirect that could be used to reach the attacker-controlled domain.How the chain works
- Host an SVG that passes through
svg-hush, but contains an embedded HTML element. - Host an image whose response includes the
Cache-Control: no-cache="Content-Security-Policy"header. Cloudflare will forward this header to the client. - Open the page in a new window, navigate to your own domain, and call
history.back(). Because the window retains awindow.openerrelationship it is not eligible for the back-forward cache, so Chromium falls back to the HTTP cache — now without CSP. - The script from the SVG executes in the context of the target domain.
Vendors
Products