CVE-2025-65019: Astro Cloudflare adapter has a Stored Cross Site Scripting vulnerability in /_image endpoint

Published Nov 19, 2025
·
Updated

Summary A Cross-Site Scripting (XSS) vulnerability exists in Astro when using the @astrojs/cloudflare adapter with output: 'server'. The built-in image optimization endpoint (/image) uses isRemoteAllowed() from Astro’s internal helpers, which unconditionally allows data: URLs. When the endpoint receives a valid data: URL pointing to a malicious SVG containing JavaScript, and the Cloudflare-specific implementation performs a 302 redirect back to the original data: URL, the browser directly executes the embedded JavaScript. This completely bypasses any domain allow-listing (image.domains / image.remotePatterns) and typical Content Security Policy mitigations.

Affected Versions - @astrojs/cloudflare ≤ 12.6.10 (and likely all previous versions) - Astro ≥ 4.x when used with output: 'server' and the Cloudflare adapter

Root Cause – Vulnerable Code File: nodemodules/@astrojs/internal-helpers/src/remote.ts

ts export function isRemoteAllowed(src: string, ...): boolean { if (!URL.canParse(src)) { return false; } const url = new URL(src);

// Data URLs are always allowed if (url.protocol === 'data:') { return true; }

// Non-http(s) protocols are never allowed if (!['http:', 'https:'].includes(url.protocol)) { return false; } // ... further http/https allow-list checks }

In the Cloudflare adapter, the /image endpoint contains logic similar to:

ts const href = ctx.url.searchParams.get('href'); if (!href) { // return error }

if (isRemotePath(href)) { if (isRemoteAllowed(href, imageConfig) === false) { // return error } else { //redirect to return the image return Response.redirect(href, 302); } }

Because data: URLs are considered “allowed”, a request such as: https://example.com/image?href=data:image/svg+xml;base64,PHN2Zy... (base64-encoded malicious SVG)

triggers a 302 redirect directly to the data: URL, causing the browser to render and execute the malicious JavaScript inside the SVG.

Proof of Concept (PoC)

1. Create a minimal Astro project with Cloudflare adapter (output: 'server'). 2. Deploy to Cloudflare Pages or Workers. 3. Request the image endpoint with the following payload:

https://yoursite.com/image?href=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxzY3JpcHQ+YWxlcnQoJ3pvbWFzZWMnKTwvc2NyaXB0Pjwvc3ZnPg==

(Base64 decodes to: <svg xmlns="http://www.w3.org/2000/svg"><script>alert('zomasec')</script></svg>)

4. The endpoint returns a 302 redirect to the data: URL → browser executes the <script> → alert() fires.

Impact - Reflected/Strored XSS (depending on application usage) - Session hijacking (access to cookies, localStorage, etc.) - Account takeover when combined with CSRF - Data exfiltration to attacker-controlled servers - Bypasses image.domains / image.remotePatterns configuration entirely

Safe vs Vulnerable Behavior Other Astro adapters (Node, Vercel, etc.) typically proxy and rasterize SVGs, stripping JavaScript. The Cloudflare adapter currently redirects to remote resources (including data: URLs), making it uniquely vulnerable.

References - Vulnerable function: https://github.com/withastro/astro/blob/main/packages/internal-helpers/src/remote.ts - Similar data: URL bypass in WordPress: CVE-2025-2575

Other sources

Astro is a web framework. Prior to version 5.15.9, when using Astro's Cloudflare adapter (@astrojs/cloudflare) with output: 'server', the image optimization endpoint (/image) contains a critical vulnerability in the isRemoteAllowed() function that unconditionally allows data: protocol URLs. This enables Cross-Site Scripting (XSS) attacks through malicious SVG payloads, bypassing domain restrictions and Content Security Policy protections. This issue has been patched in version 5.15.9.

NVD

Affected Software

3 affected componentsFixes available
astro Cloudflare adapter<5.15.9
npm/astro<5.15.9
5.15.9
astro Astro Node.js<5.15.9

Event History

Nov 19, 2025
CVE Published
via MITRE·04:40 PM
Data Sourced
via MITRE·04:40 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·05:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Advisory Published
via GitHub·08:09 PM
Data Sourced
via GitHub·08:09 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-65019?

CVE-2025-65019 is classified as a critical vulnerability due to its potential to allow unauthorized access through the isRemoteAllowed() function.

2

How do I fix CVE-2025-65019?

To fix CVE-2025-65019, upgrade to Astro's Cloudflare adapter version 5.15.9 or later.

3

What versions are affected by CVE-2025-65019?

CVE-2025-65019 affects all versions of Astro's Cloudflare adapter prior to version 5.15.9.

4

What components of Astro are impacted by CVE-2025-65019?

CVE-2025-65019 specifically impacts the Astro Cloudflare adapter when using the output: 'server' configuration.

5

What is the main issue of CVE-2025-65019?

The main issue in CVE-2025-65019 is that the image optimization endpoint permits data: protocol requests without proper validation.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203