Guides · ← All guides
Host Header Injection: Poisoned Reset Links and Cache Attacks Explained
Published: November 14, 2026 · Last reviewed: November 14, 2026 · 7 min read
Run a free BreachHunter assessment on your site →
The Host header is routing information that became application input somewhere along the way: multi-tenant platforms, absolute URL generation, CDN and proxy setups all read it. Reading it is necessary. Trusting it — any value, from anyone — is the vulnerability, and it hides inside features (reset links, canonical URLs, cache keys) rather than in obvious attack surface.
This guide covers the two canonical attacks the check is modeled on (reset-link poisoning and web-cache poisoning), the proxy configurations that accidentally create the flaw, and the allow-list fix: the application knows its own names — it should accept exactly those.
Poisoned password resets: the attack, step by step
The attacker needs only the victim's email address — public knowledge for most professionals. They submit the forgot-password form for that address while setting the request's Host header to a domain they control. A vulnerable application generates the reset link from that header: https://evil.example/reset?token=REAL-TOKEN. The email that arrives in the victim's inbox is genuinely from your system, passes every authentication check (SPF, DKIM, DMARC all validate your sending), and carries a live token pointed at the wrong domain. If the victim clicks and the attacker harvests the token from their server logs before it expires, the account is theirs.
The variation is cache poisoning: if a shared cache keys responses without including the Host, one poisoned request's page — with evil.example URLs baked into its links and assets — gets served to subsequent real visitors. The audit's check probes the acceptance question (does a foreign Host produce a working, self-referential response?) because that acceptance is the root both attacks share.
The fix: an allow-list of your own names
Applications should validate Host against the names they actually serve — the apex, www, and any tenant domains — and reject or default everything else. Frameworks increasingly ship this control (ALLOWED_HOSTS and its equivalents); the finding usually means it was never configured, or a proxy was set to pass Host through in a way that bypasses it. Related headers deserve the same discipline: X-Forwarded-Host is a Host header with extra trust and less justification — if the app reads it, it gets the same allow-list.
Verification mirrors the check: request your forgot-password flow (on a test account) with a foreign Host and confirm the emailed link — if one is sent at all — uses your real domain; request pages with foreign Hosts and confirm rejection or canonical behavior. Password-reset flows are the highest-stakes instance, so they get tested first, but the allow-list is application-wide, one control for every feature that builds a URL.
Worked example: moonrisephoto.example
Moonrise Photography's client galleries use emailed links for access and password resets for accounts. The host-header check requested the homepage and the reset flow with a foreign Host — and the application happily identified itself as the attacker's domain in both:
GET / Host: galleries-moonrise.example-verify.com -> 200, page links + canonical all on the foreign host POST /forgot-password (test account) Host: same foreign value -> reset email link built on the foreign host, valid token
The fix was the framework's host allow-list: two legitimate names, everything else rejected with 400 at the edge. The retest's foreign-Host requests got rejections, the test reset email carried the real domain, and the studio's legitimate subdomain (the blog) was added to the list deliberately — with a note in the report response explaining it, turning a HIGH-concern finding into a reviewed configuration.
The five actions to take
Locking Host handling to your real names:
- List every hostname the application legitimately serves (apex, www, subdomains, tenant patterns) — the allow-list source.
- Configure Host validation in the framework (ALLOWED_HOSTS equivalents) and at the edge; reject unknown hosts with 400.
- Audit X-Forwarded-Host handling: only honor it from your own proxy, and validate it against the same list.
- Test the password-reset flow with a foreign Host on a test account; confirm links always use a real domain.
- Ensure caches vary or key on Host correctly, then re-scan to confirm the check passes.
Run a free BreachHunter assessment on your site →
Frequently asked questions
Why would our app trust the Host header at all?
Because it must route by it — virtual hosting and multi-tenancy run on Host. The flaw is not reading it but using an arbitrary value to build security-relevant output (reset links, canonicals) without checking it against the names you own.
Can email authentication (SPF/DKIM) stop poisoned reset emails?
No — the poisoned email is genuinely sent by your system, so it authenticates perfectly. The token's destination is the attack, and it lives entirely in the link your app generated. That is what makes this class nasty: every mail-layer control passes.
We sit behind a CDN. Does that protect us?
Only if the CDN normalizes or validates Host and the origin refuses direct access. Otherwise attackers bypass the edge and hit the origin with any Host they like. The audit tests the public path; also test your origin directly if it is reachable.
Is rejecting unknown hosts risky for legitimate traffic?
The risk is forgetting a real name (an old campaign domain, a regional variant) — which is why the checklist starts with an inventory, and why rejections should be logged and reviewed in the first week. Unknown-host logs are also excellent attack telemetry afterwards.
What is the difference between this and the open-redirect finding?
Both abuse request-supplied destinations. Open redirect trusts a parameter in the URL; host-header injection trusts a header. They often coexist in the same codebase habits — trusting request data to say where things live — and are fixed by the same instinct: validate against a list you control.
Sources
The authorities this guide is built on, in the form we check our own work against:
- RFC 9110 (2022) — HTTP Semantics — the Host field and how servers are meant to treat it.
- OWASP Forgot Password Cheat Sheet (2024) — building reset links from configured URLs, never request headers.