Cache Me If You Can: XSS in Cloudflare's /cdn-cgi/image/
A cross-site scripting (XSS) vulnerability was discovered in Cloudflare's /cdn-cgi/image/ endpoint due to a bypass in the svg-hush SVG sanitizer combined with Chromium's handling of Cache-Control no-cache header directives that exclude Content-Security-Policy and Content-Type headers from cached responses.
The vulnerability chain involves three key components: a serialization bug in the svg-hush SVG sanitizer that allows injection of unescaped namespace attributes, Chromium's selective header exclusion from cached responses via Cache-Control: no-cache="Content-Security-Policy, Content-Type", and an open redirect chain through Cloudflare Access endpoints enabling attacker-controlled image loading even under restrictive source configurations. This allows an attacker to bypass strict Content Security Policies and cause execution of attacker-controlled scripts via SVG images served through Cloudflare's image transformation service. Similar techniques were demonstrated on Netlify Image CDN and S3-backed origins using signed URL response header overrides.
0.60
(below the 0.75 AUTO threshold) and has not
passed automated verification. Inspect the source quote and affected packages manually
before acting on it.
Pre-CVE to NVD / OSV Lifecycle Tracker
Last checked 2026-12-01 16:18 UTCAffected Packages & Deterministic Ranges
| Ecosystem | Canonical PURL | Affected Range | Fixed Version | Grounding | Registry |
|---|---|---|---|---|---|
| Generic | pkg:generic/cloudflare/cdn-cgi-image | All versions (unbounded) | — | quote_only_weak | skipped |
Verbatim Grounded Evidence
Verified verbatim substring matches copied directly from the source article body.
“After achieving XSS through Cloudflare's /cdn-cgi/image/ endpoint, we wondered whether the same Cache-Control primitive could be used elsewhere. Looking into mainstream frameworks offering similar image-optimization features, such as Next.js, we quickly encountered limitations. Next.js, for example, only retrieves the s-maxage or max-age directive before converting its value to an integer. However, after pushing the research further, one service stood out: Netlify Image CDN. For Netlify, the conditions under which a remote image can be loaded depend on the remote_images configuration. We identified three potential scenarios: - remote_images contains a catch-all regular expression: [images] remote_images = [".*"] - remote_images contains an incorrectly escaped regular expression. For example, the following configuration also accepts https://aab.com/ because [images] remote_images = ["^https://a.b.com/.*$"] - An allowed origin contains an open redirect. As with /cdn-cgi/image/, the redirect destination is not checked against the remote_images configuration. The public Netlify image handler follows the same general structure: it validates the initial source URL against remote_images, then passes it to IPX with allowAllDomains enabled. When loading an image/svg+xml image, the response looked like this: HTTP/2 200 Content-Security-Policy: script-src 'none' Content-Type: image/svg+xml Cache-Status: "Netlify Edge"; fwd=miss; fwd-status=200; stored Server: Netlify Content-Length: 125 Netlify's open-source Image CDN implementation, used by Netlify Dev to emulate the production endpoint, passes SVG images to IPX. IPX then invokes SVGO's removeScripts plugin to sanitize them. The hosted implementation is not public, so we cannot confirm that it uses the exact same code path. At this point, we asked ourselves: Do we really need to understand and bypass the sanitizer to get an XSS with the Cache-Control primitive? The answer was: not really :) Until then, we had only used the qualified no-cache directive to exclude the Content-Security-Policy header from Chromium's cached representation. However, the same primitive can exclude any response header, including Content-Type. Without Content-Type or X-Content-Type-Options: nosniff, Chromium attempts to determine the response type from its contents. This is part of Chromium's MIME-sniffing implementation: #define MAGIC_HTML_TAG(tag) \ MAGIC_STRING("text/html", "<" tag) static const MagicNumber kSniffableTags[] = { MAGIC_NUMBER("text/xml", "<?xml"), MAGIC_HTML_TAG("!DOCTYPE html"), MAGIC_HTML_TAG("script"), MAGIC_HTML_TAG("html"), MAGIC_HTML_TAG("!--"), MAGIC_HTML_TAG("head"), MAGIC_HTML_TAG("iframe"), MAGIC_HTML_TAG("h1"), MAGIC_HTML_TAG("div"), MAGIC_HTML_TAG("font"), MAGIC_HTML_TAG("table"), MAGIC_HTML_TAG("a"), MAGIC_HTML_TAG("style"), MAGIC_HTML_TAG("title"), MAGIC_HTML_TAG("b"), MAGIC_HTML_TAG("body"), MAGIC_HTML_TAG("br"), MAGIC_HTML_TAG("p"), }; So, excluding Content-Type: image/svg+xml from the cached response causes an SVG beginning with <!DOCTYPE html> to be sniffed as text/html when restored from Chromium's disk cache: <!doctype html> <svg version="1.1" xmlns="http://www.w3.org/2000/svg"> ... </svg> This is especially useful because SVG documents are normally parsed as XML, which differs significantly from HTML parsing. One difference that can be exploited is how processing instructions are terminated. In XML, the processing instruction continues until ?> (source): <?pi INSIDE PI > INSIDE PI ?> In HTML, it ends at the first > (source): <?pi INSIDE PI > OUTSIDE PI ?> Because of this slight difference, markup can remain inert inside a processing instruction while the document is parsed and sanitized as SVG, then become active when the same body is reparsed as HTML. This works because SVGO's removeScripts plugin only registers an element visitor. Processing-instruction nodes are not inspected or removed. The complete primitive therefore uses the following response header: Cache-Control: no-cache="Content-Security-Policy, Content-Type" Combined with this SVG/HTML polyglot: <!doctype html> <svg version="1.1" xmlns="http://www.w3.org/2000/svg"> <?a ><script>alert(location.href)</script> a?> </svg> The resulting chain is: Thinking about where else the no-cache directive could be used led us to cloud object storage. As highlighted by the varmarunionen challenge from @avlidienbrunn, and later covered by @AmirMSafari in Content-Type Override to Stored XSS on Public Objects, publicly readable S3 objects can be requested through presigned URLs generated with our own AWS credentials. This works because the object is readable by every AWS identity, while signing the request unlocks the following GetObject response-header overrides: - response-cache-control - response-content-disposition - response-content-encoding - response-content-language - response-content-type - response-expires Btw, the response-content-type technique also works with Google Cloud Storage V4 signed URLs. The original technique consists of including response-content-type=text/html in the signed request. This overrides the stored Content-Type of an uploaded object, allowing a PNG/HTML polyglot to be served and parsed as HTML. This is especially interesting when a bucket is exposed through a custom domain, a CNAME, a proxy_pass endpoint, or any other configuration that forwards the original query parameters to S3. However, the technique does not work on its own when the storage response is protected by a CSP. This is where Chromium's Cache-Control: no-cache="<field-name>" behavior can push it further. By also including the following signed parameter: response-cache-control=no-cache="Content-Security-Policy"”
Credibility Gate Breakdown
- • Quote matched article text but does not mention package 'cloudflare/cdn-cgi-image'.
- • Capped specificity below AUTO threshold due to weak quote grounding (missing package or version tokens inside quote).
- • Capped specificity below AUTO threshold because version constraints lack a bounded or exact fix range.
$ curl -sL https://zerobom.dev/osv/triage/PRECVE-2026-D24B15D4.json -o PRECVE-2026-D24B15D4.json && zerobom scan --osv PRECVE-2026-D24B15D4.json --sbom sbom.cdx.json