Skip to content

Astro Cloudflare adapter has Stored Cross Site Scripting vulnerability in /_image endpoint

Moderate severity GitHub Reviewed Published Nov 19, 2025 in withastro/astro • Updated Nov 20, 2025

Package

npm astro (npm)

Affected versions

< 5.15.9

Patched versions

5.15.9

Description

Summary

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.

Details

On-demand rendered sites built with Astro include an /_image endpoint for image optimization. While this endpoint is designed to restrict processing to local images and authorized remote domains (configured via image.domains or image.remotePatterns), a critical vulnerability exists in the underlying validation logic.

The isRemoteAllowed() function in packages/internal-helpers/src/remote.ts (lines 128-131) unconditionally allows ALL data: protocol URLs without any validation or sanitization. When combined with SVG images containing JavaScript, this creates a vector for XSS attacks.

Vulnerable Code:

/packages/ packages/internal-helpers/src/remote.ts lines 128-131
if (url.protocol === 'data:') {
    return true;  // ← Unconditionally allows ALL data: URLs!
}

The vulnerability manifests differently depending on the image endpoint implementation:

  • Safe implementation: Server processes SVG and converts to raster format (PNG/JPEG), removing JavaScript
  • Vulnerable implementation: Server redirects browser to raw SVG data URL, allowing JavaScript execution

PoC

  1. Create a new minimal Astro project (astro@latest)

  2. Configure it to use the Cloudflare adapter (@astrojs/[email protected])

  3. Deploy to Cloudflare Pages or Workers.

  4. Write page to load SVG Image like : SVG XSS Payload

  5. Open directly the SVG file to show an alert (in read scenarios, the apps that use the framework will use CDN for example, to load SVG, depending that the framework is secure)

Impact

  1. XSS: Malicious URLs can be crafted to execute JavaScript in victim's browser
  2. Session Hijacking: JavaScript can access cookies and session tokens
  3. Account Takeover: Combined with CSRF, can perform unauthorized actions
  4. Data Exfiltration: Sensitive information can be stolen and sent to attacker-controlled servers

References

References

@matthewp matthewp published to withastro/astro Nov 19, 2025
Published by the National Vulnerability Database Nov 19, 2025
Published to the GitHub Advisory Database Nov 19, 2025
Reviewed Nov 19, 2025
Last updated Nov 20, 2025

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(4th percentile)

Weaknesses

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. Learn more on MITRE.

CVE ID

CVE-2025-65019

GHSA ID

GHSA-fvmw-cj7j-j39q

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.