Summary
Astro SSR applications with prerendered error pages can be tricked into fetching error content from attacker-controlled origins when the Host header is not properly validated.
Under these conditions, a crafted request can cause the server to perform server-side requests to arbitrary hosts and expose response data to the attacker.
Affected context
This vulnerability affects Astro server-side rendered (SSR) applications that:
- Use prerendered error pages such as
/404or/500withexport const prerender = true - Dynamically fetch these prerendered error pages at runtime when handling errors
- Derive the fetch URL from
request.url, whose origin is based on the incomingHostheader - Do not validate the
Hostheader against a configured set ofallowedDomainsor an equivalent origin-allowlist
In such deployments, the application's internal HTTP client can be coerced into sending requests to unintended internal or external targets.
Exploit preconditions
- Attack surface: Public-facing Astro SSR endpoints handling HTTP requests
- Required access: Ability to send crafted HTTP requests to the application, including setting arbitrary
Hostheaders - Trigger point: An error condition that causes the server to fetch the prerendered
/404or/500page, using a URL derived fromrequest.url - Why exploitation is possible: The application trusts the
Hostheader to construct the origin of the fetch URL without enforcing a strict allowlist, enabling redirection of the internal fetch to attacker-chosen hosts
Why this happens
The core issue is improper input validation on the Host header (CWE-20) combined with server-side request construction based on that untrusted value, leading to server-side request forgery (CWE-918).
The SSR error handling logic builds a fetch URL for prerendered error pages from request.url, which inherits its origin from the incoming Host header.
Without validating this header against a set of known-good domains, the server can be tricked into issuing HTTP requests to arbitrary hosts, including internal network services or metadata endpoints, and returning their responses.
Potential impact
- Access to internal HTTP services that are not directly exposed to the internet
- Reading sensitive data from internal endpoints (e.g., admin panels, internal APIs, cloud metadata services)
- Pivoting into internal networks through the web server as a proxy
- Potential information leakage about network topology and available services
- Assisting other attack chains, such as credential theft or configuration disclosure
General mitigation guidance
Effective mitigation generally focuses on constraining how origins and hosts are derived and used in server-side requests:
- Enforce strict validation of the
Hostheader (or equivalent origin source) against an explicit allowlist ofallowedDomains - Avoid constructing internal fetch URLs directly from user-controlled values such as
Host,X-Forwarded-Host, orrequest.urlwithout normalizing and validating them - Centralize origin and base-URL configuration so that server-side fetches always target known, static hosts rather than dynamic request-derived origins
- Where possible, decouple prerendered error page retrieval from runtime HTTP fetches, favoring in-process rendering or local/static asset access
- Run the application with least-privilege network access, restricting outbound connectivity to only those destinations that are required for normal operation
How teams detect issues like this
Organizations can detect and monitor this class of issue by:
- Using static analysis or linters to flag patterns where server-side HTTP clients build URLs from
request.url,Host, or similar request headers - Including checks in code review for any logic that consumes the
Hostheader or constructs dynamic origins for internal fetches - Implementing application security tests (DAST) that attempt SSRF via manipulated
Hostheaders and observe whether the server accesses unexpected endpoints - Applying runtime monitoring and egress filtering to detect unusual outbound HTTP traffic from web servers, especially to internal IP ranges or known metadata services
- Leveraging automated security scanning tools that include rules for SSRF and improper
Hostheader validation

