Researchers Uncover a Security Weakness in Cloudflare Image Transformations

Security researchers have demonstrated how multiple weaknesses in Cloudflare's Image Transformations service can be combined to bypass Content Security Policy (CSP) protections and execute malicious JavaScript on a website's origin.

The findings were published on October 28, 2026, by Kevin Gervot and Adam Kues of Searchlight Cyber in a technical report titled Cache Me If You Can. The researchers demonstrated the attack chain through Cloudflare's /cdn-cgi/image/ endpoint on cloudflare.com.

The discovery highlights how seemingly minor weaknesses in image processing, browser caching and redirect handling can combine to undermine security controls designed to prevent malicious scripts from running.

The report does not identify a CVE number or confirm whether a complete fix has been deployed.

How the Vulnerabilities Work Together

The researchers identified several interacting weaknesses rather than a single vulnerability responsible for the entire attack.

1. An SVG Sanitization Bypass

Cloudflare uses a Rust-based tool called svg-hush to sanitize SVG images. Researchers found that namespace values processed through the underlying XML serialization library were not escaped in the same way as ordinary attribute values.

This could allow specially crafted SVG content to introduce malicious markup after the sanitization stage.

2. A Browser Cache Interaction

Cloudflare's image endpoint can forward certain response headers from the original image source. Researchers found that a crafted Cache-Control directive could cause Chromium to omit the Content Security Policy header from a cached response under specific conditions.

Although the initial page load remained protected, a subsequent cache reload could remove the browser's CSP enforcement for that response, allowing the injected script to execute.

The researchers reported that this particular behavior affected Chromium in their tests, rather than Firefox or Safari.

3. Redirect Handling and Image Source Restrictions

Cloudflare Image Transformations supports restrictions on where source images can be retrieved. However, the researchers found that the image-fetching process followed redirects without rechecking whether the final destination remained within the permitted source configuration.

They used redirect behavior involving Cloudflare Access and a Cloudflare subdomain to complete the attack chain under more restrictive source settings.

The combination demonstrates how an image-processing service can become a security risk when its input validation, header handling and network-fetching rules do not work together as intended.

Why Bypassing CSP Matters

Content Security Policy is a browser security mechanism that restricts the scripts and other resources a webpage can load. It is commonly used as an additional layer of protection against cross-site scripting attacks.

Cross-site scripting, or XSS, occurs when an attacker can cause a website to execute unintended scripts within its security context. Depending on the application and the victim's permissions, this may expose sensitive information or enable unauthorized actions.

A CSP bypass can therefore weaken a site's defenses, particularly when combined with an injection flaw that introduces executable code.

However, the impact depends on the affected application, browser behavior, security configuration and the permissions available to the injected script. The finding does not mean that every website using Cloudflare is automatically vulnerable.

Similar Risks Beyond Cloudflare

The researchers also explored related cache and response-header issues involving Netlify Image CDN and certain Amazon S3 and Google Cloud Storage configurations.

These findings point to a broader engineering challenge: security depends on more than sanitizing the content of an image or document. Response headers, redirects, browser caching and content-type handling can all influence how a resource is interpreted and whether it is safe to display.

For developers and infrastructure providers, this means image proxies and file-processing services should treat both content and metadata as part of the same security boundary.

Recommended Security Measures

Organizations that use image transformation services or similar content-processing infrastructure should review their configurations and security controls.

  • Control response headers: Avoid forwarding untrusted Cache-Control and custom X-* headers without validation.

  • Review source restrictions: Ensure image-fetching services cannot reach unauthorized destinations through redirect chains.

  • Strengthen content handling: Keep SVG sanitizers and related libraries updated, and validate how processed files are served.

  • Set appropriate browser headers: Consider X-Content-Type-Options: nosniff to reduce unsafe content-type interpretation.

  • Review CSP policies: Use restrictive policies as one layer of defense, while ensuring other components cannot undermine their enforcement.

  • Monitor vendor advisories: Check Cloudflare's official security communications for confirmed remediation guidance and applicable mitigations.

These measures are general defensive recommendations based on the reported attack chain; they should not be treated as confirmation that a specific vendor fix is available.

What This Means for Cloud Security

The Cloudflare research illustrates why security teams must assess how different components interact rather than evaluating each control in isolation.

A sanitizer may appear effective on its own, and a restrictive CSP may block malicious scripts during a normal page load. Yet interactions involving caching and redirects can weaken those protections when combined.

For enterprises, the wider lesson is to test the complete request and response lifecycle of applications that process externally supplied content. Security reviews should include browser behavior, header forwarding, source restrictions and third-party integrations.

As cloud platforms support increasingly complex web applications, coordinated defenses and timely vulnerability management will remain essential to reducing exposure to chained attacks.