/

CVE-2026-25545

Severity:

HIGH RISK

(8.6)

SSRF in Astro Custom Error Page Rendering

CVE-2026-25545

Analyzed

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Server-Side Request Forgery leading to internal network access and potential cloud metadata exposure

Severity:

HIGH RISK

(8.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Server-Side Rendered Astro pages that use prerendered custom error pages like 404.astro or 500.astro may be vulnerable to SSRF when the application reflects the Host header into backend requests.

If an attacker can send requests without strict Host header validation, the server may fetch content from attacker-controlled or internal network locations and expose response bodies through the error handling flow.

Affected context

The vulnerability occurs in Astro applications that:

  • Use Server-Side Rendering (SSR) with prerendered custom error pages (e.g., 404.astro, 500.astro)
  • Are deployed in environments where the application server directly receives client traffic (no enforcing reverse proxy in front, or proxies that pass arbitrary Host headers)
  • Do not perform strict validation or normalization of the Host header

In such setups, the framework's error handling can be influenced by the Host header in a way that causes server-side HTTP requests to untrusted or internal targets.

Exploit preconditions

  • Attack surface: Public-facing HTTP(S) endpoint of the Astro application.
  • Required access: Network access sufficient to send crafted HTTP requests directly to the application server, including the ability to manipulate the Host header.
  • Trigger point: A server-side error that causes Astro to render a prerendered custom error page (e.g., 500.astro -> /500.html).
  • Why exploitation is possible: The application's error handling logic issues or follows server-side requests influenced by the attacker-controlled Host header. When the error page is fetched using the spoofed host, the server contacts an attacker-controlled endpoint, which can then redirect to internal IPs or services, with the original error response path exposing the resulting response body.

Why this happens

This issue stems from treating client-controlled HTTP header values, particularly Host, as trustworthy inputs when constructing or resolving server-side requests during error page rendering.

Astro's handling of prerendered error pages allows the Host header to influence what the server fetches for resources like /500.html. Because the framework does not sufficiently constrain which origins or addresses may be contacted in this flow, attackers can cause the server to initiate requests to arbitrary locations, including internal network addresses and cloud metadata services.

This maps to CWE-918: Server-Side Request Forgery (SSRF), where a server application performs HTTP requests based on attacker-controlled parameters without enforcing strict allowlists or network boundaries.

Potential impact

  • The server may fetch attacker-controlled URLs, allowing observation of how internal requests are made.
  • Attackers could cause the server to access internal IPs and services not directly exposed to the internet.
  • Cloud metadata endpoints could be queried, potentially exposing credentials, tokens, or configuration secrets.
  • Internal HTTP services (admin panels, internal APIs, monitoring endpoints) might be queried and their response bodies leaked via the primary HTTP response.
  • SSRF could be chained with other weaknesses (e.g., misconfigured internal services) to pivot further within the network.

General mitigation guidance

Effective mitigation focuses on neutralizing attacker control over server-initiated requests and hardening network trust boundaries:

  • Enforce strict validation of the Host header at the edge (load balancer, reverse proxy, or application), rejecting or normalizing unexpected host values.
  • Decouple error page fetching from untrusted header input; error templates should be resolved using server-side configuration or fixed paths rather than client-supplied values.
  • Apply an allowlist-based approach for any server-side HTTP requests, limiting outbound connections to explicitly approved domains or IP ranges.
  • Restrict network egress from application servers using firewall rules, security groups, or service mesh policies to prevent arbitrary access to internal networks and cloud metadata endpoints.
  • Design error handling so that failures are rendered locally (e.g., from templates, static assets) without issuing secondary HTTP requests based on request metadata.

How teams detect issues like this

Detection typically combines code-level review and runtime monitoring:

  • Static analysis / code review:
  • Look for code or configuration where server-side requests depend on Host, URL, or other headers derived directly from the client.
  • Identify SSR error handlers or middleware that dynamically construct URLs for error pages or redirects using request metadata.
  • Review gateway and proxy configurations to ensure Host header validation is enforced and not bypassed.
  • Dynamic / runtime monitoring:
  • Monitor outbound HTTP traffic patterns from application servers, alerting on requests to unexpected internal ranges (e.g., 127.0.0.0/8, 169.254.169.254, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16).
  • Use application logs to correlate error responses (e.g., 500 errors) with unusual Host headers and outbound request activity.
  • Leverage security scanners or penetration testing routines that probe for SSRF by varying the Host header and checking for callbacks to controlled endpoints.
  • Policy enforcement:
  • Integrate SSRF-focused checks into CI/CD using linters or SAST rules aimed at server-side request construction.
  • Enforce infrastructure policies that block metadata endpoint access from application containers unless explicitly required.

Sources

SourceLink
github.comgithub.com/withastro/astro/commit/e01e98b063e90d274c42130ec2a60cc0966622c9
github.comgithub.com/withastro/astro/releases/tag/%40astrojs%2Fnode%409.5.4
github.comgithub.com/withastro/astro/security/advisories/GHSA-qq67-mvv5-fw3g

Frequently asked

questions

Yes. An external attacker who can send HTTP requests directly to the Astro application and control the Host header can exploit this SSRF behavior, assuming there is no effective host validation or protective proxy in place.

Typically no. The described scenario relies on unauthenticated access to the application's HTTP endpoint and the ability to trigger an error that leads to rendering a custom error page. However, if the application is behind authentication, the attacker would need whatever level of access is required to hit routes that can produce such errors.

The safest pattern is to strictly validate or normalize the Host header at the earliest entry point, and to ensure error page resolution does not depend on untrusted request headers. Additionally, server-side requests should be constrained via allowlists and network controls so that only explicitly trusted destinations are reachable.

Adopt a defense-in-depth strategy for SSRF: treat all client-supplied URL components and headers as untrusted, enforce robust host and origin validation, restrict egress at the network layer, and review error handling flows to avoid secondary requests based on request metadata. Incorporating SSRF-specific checks into design reviews, threat modeling, and automated security testing helps catch these patterns early.

Find out what's already
exploitable in your codebase.