CVE-2025-65019
Executive Summary
CVE-2025-65019 is a Cross-Site Scripting (XSS) vulnerability in the Astro web framework, specifically affecting deployments using the @astrojs/cloudflare adapter with output: 'server'. The vulnerability resides in the image optimization endpoint (/_image), where the isRemoteAllowed() function unconditionally permits data: protocol URLs. This allows an attacker to inject malicious SVG payloads, bypassing domain restrictions and Content Security Policy (CSP) protections. The vulnerability has a CVSS score of 5.4 (Medium) and is currently unpatched in versions prior to 5.15.9. No public exploit code or proof-of-concept is available at this time.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the Astro npm package ecosystem, specifically the @astrojs/cloudflare adapter. Organizations using Astro with Cloudflare Workers or Pages in server mode are at risk. The supply chain risk is moderate, as the vulnerability is in a first-party adapter, not a third-party dependency. Users should update to Astro 5.15.9 or later to mitigate the risk.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- Base Score: 5.4 (Medium)
- Attack Vector (AV): Network (N) - Exploitable remotely.
- Attack Complexity (AC): Low (L) - No special conditions required.
- Privileges Required (PR): None (N) - No authentication needed.
- User Interaction (UI): Required (R) - Victim must click or load a crafted link.
- Scope (S): Changed (C) - Impact extends beyond the vulnerable component.
- Confidentiality (C): Low (L) - Limited information disclosure.
- Integrity (I): Low (L) - Limited ability to modify content.
- Availability (A): None (N) - No impact on availability.
Threat Level: Medium. While the CVSS score is moderate, the ability to bypass CSP and domain restrictions elevates the risk in environments with strict security policies.
Deep Dive & Mechanics
The vulnerability is in the isRemoteAllowed() function within the @astrojs/cloudflare adapter. This function is responsible for validating URLs passed to the image optimization endpoint (/_image). The flaw is that the function unconditionally allows data: protocol URLs, which can contain arbitrary data, including malicious SVG content.
Attack Flow:
- An attacker crafts a URL like:
https://victim.com/_image?href=data:image/svg+xml,<svg onload=alert(1)> - The
isRemoteAllowed()function checks the URL and, due to the bug, permits thedata:protocol. - The image optimization endpoint processes the URL and returns an SVG image containing the malicious payload.
- When a victim's browser loads this image, the SVG executes the JavaScript payload, leading to XSS.
Why it bypasses CSP: The data: protocol is often allowed in CSP directives for images (img-src data:), but the vulnerability allows the attacker to inject script into the SVG, which executes in the context of the page, bypassing typical CSP protections.
Vulnerable vs. Patched Code
Vulnerable Code (prior to 5.15.9):
// In @astrojs/cloudflare adapter
function isRemoteAllowed(url) {
// Bug: No check for data: protocol
return true; // Unconditionally allows all URLs
}
Patched Code (5.15.9):
// In @astrojs/cloudflare adapter
function isRemoteAllowed(url) {
// Fix: Explicitly block data: protocol
if (url.startsWith('data:')) {
return false;
}
// Additional domain validation logic
return allowedDomains.some(domain => url.startsWith(domain));
}
The patch adds a check to reject any URL starting with data:, preventing the injection of malicious SVG payloads.
Exploitation & Lab Setup
Red Team (Offensive)
Prerequisites:
- Astro application using
@astrojs/cloudflareadapter withoutput: 'server' - Version prior to 5.15.9
Exploitation Steps:
- Identify a target running the vulnerable Astro version.
- Craft a malicious SVG payload:
<svg xmlns="http://www.w3.org/2000/svg" onload="alert('XSS')"> <rect width="100" height="100" fill="red"/> </svg> - URL-encode the payload and construct the exploit URL:
https://victim.com/_image?href=data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20onload%3D%22alert%28%27XSS%27%29%22%3E%3Crect%20width%3D%22100%22%20height%3D%22100%22%20fill%3D%22red%22%2F%3E%3C%2Fsvg%3E - Send the link to a victim or embed it in a page.
- When the victim loads the URL, the SVG executes the JavaScript.
Note: No public exploit code is available; this is a theoretical exploitation based on the vulnerability description.
Blue Team (Defensive)
Detection:
- Monitor logs for requests to
/_imagewithhrefparameters containingdata:protocol. - Look for unusual SVG content in image optimization requests.
Hunting:
- Search for
data:image/svg+xmlin web server logs. - Check for unexpected CSP violations related to
img-srcorscript-src.
Response:
- Immediately update to Astro 5.15.9 or later.
- If immediate patching is not possible, implement a WAF rule to block
data:protocol in/_imagerequests.
Indicators of Compromise (IOCs)
- URL Pattern:
/_image?href=data:image/svg+xml,... - Log Entry: Requests to
/_imagewithdata:protocol in thehrefparameter. - Network Traffic: HTTP requests containing
data:image/svg+xmlin the query string. - File Hashes: No specific file hashes; the vulnerability is in the code logic, not a specific binary.
Detection Engineering
YARA Rule
rule CVE_2025_65019_Astro_XSS {
meta:
description = "Detects attempts to exploit CVE-2025-65019 in Astro Cloudflare adapter"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-65019"
strings:
$data_protocol = /\/_image\?href=data:/ nocase
$svg_payload = /<svg[^>]*onload=/ nocase
condition:
$data_protocol or $svg_payload
}
Sigma Rule
title: CVE-2025-65019 Astro Cloudflare Adapter XSS Attempt
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects HTTP requests attempting to exploit CVE-2025-65019 via data: protocol in /_image endpoint
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-uri-query|contains: "/_image?href=data:"
condition: selection
falsepositives:
- Legitimate use of data: URIs in image optimization (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-65019 Astro Cloudflare Adapter XSS Attempt"; flow:to_server; content:"/_image?href=data:"; http_uri; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Patch: Update Astro to version 5.15.9 or later.
- WAF Rule: Block requests to
/_imagewithdata:protocol in thehrefparameter. - CSP Hardening: Add
object-src 'none'andscript-src 'strict-dynamic'to CSP headers.
Long-term Measures:
- Implement input validation for all URL parameters in image optimization endpoints.
- Regularly audit dependencies and adapters for security vulnerabilities.
- Use a Web Application Firewall (WAF) with virtual patching capabilities.
Workaround (if patching is delayed):
- Disable the image optimization endpoint by configuring the Cloudflare adapter to not use
/_imageor by adding a middleware that rejectsdata:URLs.
Valters IT