Skip to content
Vol. 1 · Ed. 2026
CyberGlossary
Entry № 548

Host Header Injection

Reviewed byCybersecurity entrepreneur & security researcher

What is Host Header Injection?

Host Header InjectionA vulnerability where an application trusts the HTTP Host (or X-Forwarded-Host) header to build URLs, allowing attackers to redirect users or poison caches.


Host header injection occurs when server-side code uses the HTTP Host header — or proxy variants like X-Forwarded-Host — to construct absolute URLs (password-reset links, redirects, image src, canonical tags, OAuth callbacks) without validating it against an allow-list. Because the header is attacker-controlled, the application can be tricked into emitting links that point at a hostile domain.

The highest-impact case is password-reset poisoning: the app builds the reset link from the Host/X-Forwarded-Host header, so an attacker who knows a victim's username submits a reset request with a malicious header, and the victim receives a genuine email whose link leaks the single-use token to the attacker's server when clicked. This exact flaw is tracked as CVE-2022-29933 in Craft CMS (≤ 3.7.36), classified CWE-640 (weak password recovery) with a CVSS 3.1 base score of 8.8 — the reset endpoint trusted X-Forwarded-Host when building the email. The same primitive also enables web-cache poisoning, routing-based SSRF, and open redirects.

It is common in reverse-proxy stacks where several components each expose a Host input. Mitigations: derive URLs from a single configured trusted hostname rather than the request, validate Host/X-Forwarded-Host against a strict allow-list, strip untrusted forwarded headers at the edge, use absolute-free relative links where possible, and deploy HSTS to limit downgrade abuse.

flowchart TB
  A["Attacker submits password reset<br/>for victim's username"] --> H["Request carries<br/>Host: attacker.com"]
  H --> App["App builds reset link from<br/>the Host header (no allow-list)"]
  App --> M["Genuine email sent to victim:<br/>https://attacker.com/reset?token=..."]
  M --> V["Victim clicks the trusted-looking link"]
  V --> T["Single-use token delivered<br/>to attacker.com"]
  T --> TO["Attacker completes reset<br/>= account takeover"]

● Examples

  1. 01

    Triggering a password reset that emails a link to https://attacker.com/reset?token=... because the app uses Host.

  2. 02

    Poisoning a CDN cache by sending X-Forwarded-Host to make /index emit attacker URLs.

● Frequently asked questions

What is Host Header Injection?

A vulnerability where an application trusts the HTTP Host (or X-Forwarded-Host) header to build URLs, allowing attackers to redirect users or poison caches. It belongs to the Vulnerabilities category of cybersecurity.

What does Host Header Injection mean?

A vulnerability where an application trusts the HTTP Host (or X-Forwarded-Host) header to build URLs, allowing attackers to redirect users or poison caches.

How do you defend against Host Header Injection?

Defences for Host Header Injection typically combine technical controls and operational practices, as detailed in the full definition above.

What are other names for Host Header Injection?

Common alternative names include: X-Forwarded-Host injection, Virtual host abuse.

● Related terms