Host Header SSRF

Routing-based SSRF where the server reconstructs an outbound/base URL from attacker-controlled Host / X-Forwarded-* headers (or an absolute request line), so a header rewrite — not a URL parameter — steers a server-side request to internal targets.

How it works

When an application sits behind a reverse proxy and derives its own origin from request headers, those headers become an SSRF sink. Two shapes:

  • Routing-based SSRF: the front proxy forwards by Host; set Host: (or X-Forwarded-Host) to an internal IP/hostname and the proxy routes your request to internal services (e.g. 192.168.0.0/24, an admin panel). In Burp, uncheck “update Host header to match target.” A connection-state variant validates the first request on a keep-alive connection and trusts later pipelined requests with a malicious Host (PortSwigger-style host-validation bypass).
  • SSR URL reconstruction: SSR frameworks build an absolute fetch URL from Host/X-Forwarded-* for error pages, server actions, image optimization, or middleware redirects; a forged header makes the server fetch an internal URL and (often) return the body — full-read SSRF.

Absolute-form request lines and proxy path-normalization differences (backslash vs. slash) are adjacent routing tricks that reach handlers the edge was supposed to intercept. Password-reset poisoning is the same Host-injection root cause applied to link generation (not covered here; this page is the SSRF/routing facet).

Techniques / payloads

GET / HTTP/1.1
Host: 169.254.169.254            # or 192.168.0.1 / internal-service
X-Forwarded-Host: 169.254.169.254
  • Next.js Server Actions (CVE-2024-34351): app uses Server Actions and the action redirects to a relative path (/...); the handler rebuilds the stream target from req.headers['host'], so a forged Host: makes the server issue a request to your OAST host (first request fires a HEAD to the header value). Preconditions from Assetnote’s original research.
  • Next.js /_next/image: remotePatterns/allowlist + redirect-following → chain an open redirect on an allowlisted domain to internal blind SSRF: /_next/image?url=https://third-party.com/logout%3furl%3Dhttps%3A%2F%2Flocalhost%3A2345%2F...&w=256&q=75. See Open Redirect to SSRF.
  • OpenNext/Cloudflare (CVE-2026-3125): path-normalization bypass — /cdn-cgi\image/ (backslash) evades Cloudflare edge interception; the JS URL class normalizes \→/, hits the dev-only handler, and fetches arbitrary remote URLs. See URL Parser Differentials.

Notable cases

  • CVE-2024-34351 — Next.js Server Actions SSRF via Host header on relative redirects.
  • CVE-2025-57822 — Next.js middleware: headers passed to NextResponse.next() / improper redirect (Location) handling → SSRF in self-hosted apps; patched 14.2.32 / 15.4.7. Escalated to RCE via an internal Jenkins (Groovy console) in the Intigriti CatFlix CTF.
  • CVE-2026-25545 — Astro SSR: Host-header injection in prerendered custom error pages (404.astro/500.astro); the fabricated URL is fetched, redirects followed, response returned → full-read SSRF to localhost/internal. Patched astro 5.17.2 / @astrojs/node 9.5.3 / 6.0.0-beta.11.
  • Angular SSR (GHSA-xh43-g2fq-wjrj) — internal URL-reconstruction trusted Host and X-Forwarded-* without validating the destination origin → SSRF + header injection; SSR deployments only.
  • CVE-2026-3125 — @opennextjs/cloudflare path-normalization SSRF (backslash) (<1.17.1).
  • Centauri (CVE-2026-109618, CVSS 10.0) — reverse proxy tricked into proxying arbitrary absolute URLs due to request-rewriting/routing evolution → internal access / DDoS.
  • PortSwigger Web Security Academy labs: routing-based SSRF via Host, and host-validation bypass via connection-state attack (reach 192.168.0.1/admin).

Defenses

  • Never derive the outbound/base origin from request headers; configure a fixed canonical host/origin server-side. Reject requests whose Host/X-Forwarded-Host isn’t in an allowlist at the edge.
  • Validate and pin redirect targets; don’t follow redirects to private ranges in image optimizers; normalize paths consistently between edge and app (watch \ vs /). See URL Parser Differentials.
  • Egress-restrict SSR renderers; block 169.254.169.254/internal; enforce IMDSv2. General guidance: SSRF Prevention.

Sources