Host Header Injection: Poisoning the Reset Link

Day 16 made a template engine run your code. Today the application trusts something far more ordinary, the Host header of its own incoming HTTP request, and that trust alone is enough to turn a password reset email into a credential-stealing link. Host Header Injection happens when an application uses the client-supplied Host header to build URLs, links, or security-sensitive logic, instead of relying on a value the server itself controls.
This is the fifteenth class in the series, and it belongs in the same family as CSRF from Day 8 and SSRF from Day 9, a boundary the developer assumed was safe because it looked like server-controlled plumbing rather than user input. The Host header feels structural. It is not. The client sends it on every request, and like every other header, the client can set it to whatever it wants.
Inside scope only, using accounts you control. The clearest demonstration of this bug is poisoning your own password reset link and showing the token points at a server you control. Never attempt this against a real victim’s account.
What the Host header actually is, and why applications trust it
HTTP/1.1 requires every request to carry a Host header, originally so a single physical server hosting multiple websites, virtual hosting, could know which site the client meant to reach.
GET /reset-password HTTP/1.1
Host: example.com
Most of the time, the server already knows its own canonical domain name, it is configuration, not something it needs to ask the client for. But a surprising number of applications, instead of hardcoding or configuring that value, read it straight from the incoming Host header and use it to build absolute URLs: password reset links, email verification links, canonical links, cache keys, and sometimes even authentication logic tied to an expected origin.
# vulnerable pattern
reset_link = "https://" + request.headers['Host'] + "/reset?token=" + token
send_email(user_email, reset_link)
Change the Host header on the reset request to attacker.com, and the generated link in the email becomes https://attacker.com/reset?token=.... The token is real. The victim’s email account received a completely legitimate-looking reset email from the real application. The link in it simply points somewhere else.
This is exactly the root cause behind CVE-2026-29199 in phpBB, where the password reset link generation routine built the reset URL directly from the inbound Host header value with no validation against a configured canonical hostname, allowing an attacker to cause password reset emails to embed links pointing at an attacker-controlled domain.
Why this still works, structurally
The header looks like infrastructure, not input. Developers routinely sanitize query parameters and form fields because those obviously come from the user. A header that exists specifically to identify which virtual host the client meant to reach does not trigger the same instinct, even though it arrives in exactly the same untrusted request.
Load balancers and reverse proxies add more headers that carry the same risk. X-Forwarded-Host, X-Host, X-Forwarded-Server, and similar headers exist specifically so a proxy can tell the backend what the original client-facing hostname was. Applications behind a proxy sometimes trust these secondary headers even when they have correctly locked down the primary Host header, not realizing the proxy itself may forward an attacker-supplied value for these without validation.
Password reset and email verification flows are disproportionately exposed. Both are specifically designed to generate a link and send it somewhere the recipient will click without re-checking the domain closely, exactly the mechanism a 2026 independent bug bounty writeup documented in detail: intercepting a password reset request, replacing the Host header with an attacker-controlled domain, and receiving a legitimate reset email containing a token embedded in a link pointing at the attacker’s own server.
Web cache poisoning multiplies a single successful injection. If a caching layer sitting in front of the application includes the Host header, or a similar header, as part of its cache key, and the application’s response varies based on that header, poisoning the cached response once can affect every subsequent visitor who receives that cached page until the cache entry expires or is purged.
Real disclosed reports
- Periscope TV via Twitter OAuth login, host header manipulation leading to account takeover, $7,560 bounty. Reported by researcher Ron Chan, this flaw exploited the OAuth login flow between Periscope and Twitter. By changing the
Host header during the login flow, the OAuth redirect destination itself changed, allowing an attacker to send a crafted authorization link to a victim and, once clicked, obtain the victim’s account access token. PortSwigger’s Daily Swig specifically noted this as a novel application of host header manipulation against a federated login flow, rather than the more commonly discussed password reset variant, and flagged that other companies using similar token-based third-party login integrations could plausibly share the same underlying weakness.
- PayPal, denial of service via web cache poisoning, 810 upvotes, $9,700 bounty. One of the most upvoted disclosed reports in HackerOne’s public history for this general category, demonstrating that header-based cache poisoning on major, heavily trafficked infrastructure is both findable and taken seriously at the highest payout tiers, even when the direct impact is availability rather than credential theft.
- Shopify themes subdomain, host header web cache poisoning leading to denial of service, 72 upvotes, $2,900 bounty. The researcher found that setting the
Host header to the same domain but a different, non-active port was sufficient to get the value accepted and cached, resulting in cache poisoning that broke the page for other visitors, a good example of a lower-effort variant of this bug still being valid and paid.
- CVE-2026-29199, phpBB authentication-adjacent flaw via Host Header Injection enabling password reset link poisoning, affecting versions before 3.3.16. The root cause was the password reset URL generation routine trusting the client-supplied
Host header instead of binding to a configured canonical hostname, letting an attacker cause reset emails to embed links pointing at an attacker-controlled domain. The project’s fix specifically hardened URL generation to rely on configured server variables rather than the inbound header, exactly the remediation pattern this bug class calls for in general.
- A private bug bounty program, password reset poisoning via Host Header Injection, documented in a widely shared 2026 independent writeup. The researcher intercepted a password reset request, replaced the
Host header with an attacker-controlled domain, and received a password reset email containing a valid token embedded in a link pointing at their own server, turning the finding into what they described as a 1-click account takeover. Notably, the report was marked out of scope under that specific program’s policy, since the program explicitly excluded “email hyperlink injection” as a category, a useful reminder that scope wording matters enormously for this bug class specifically, and is worth checking carefully before investing testing time.
Read the Periscope and Twitter OAuth case first, since it demonstrates an escalation path beyond the more commonly discussed password reset variant, applying the exact same root technique to a federated login flow instead. Then read the phpBB CVE for the clearest single-root-cause writeup connecting the vulnerable code pattern directly to the fix.
The main variants
Password reset and email verification link poisoning. The core technique demonstrated repeatedly above. Works whenever the reset or verification link’s domain is built from the request’s Host header rather than a fixed, server-side configured value.
OAuth and SSO redirect manipulation. The Periscope and Twitter case specifically. If an OAuth flow’s redirect URI, or any part of the flow that embeds the application’s own domain, is built from the Host header rather than a strictly validated, pre-registered redirect URI, an attacker can redirect the resulting authorization code or token to a server they control.
Web cache poisoning. If a caching layer varies its cached response based on the Host header, or a related header, and the application reflects that header’s value into the response in some way, a single poisoned request can corrupt the cached version served to every subsequent visitor, exactly the PayPal and Shopify cases above.
Routing-based security bypass. Some applications or infrastructure make access control or virtual host routing decisions based on the Host header, and a crafted value can occasionally cause a request to be routed to an internal-only virtual host or an unintended backend service that would not otherwise be reachable directly.
Secondary header variants, X-Forwarded-Host and similar. Even an application that correctly validates the primary Host header can remain fully vulnerable through X-Forwarded-Host, X-Host, or X-Forwarded-Server, if any internal logic, or an intermediate proxy, trusts one of these instead.
Where to look, pointed at your recon
- Password reset and email verification flows specifically. This is consistently where the highest-impact, most reliably exploitable instances of this bug class are found, as nearly every real-world example above demonstrates.
- Any OAuth, SSO, or third-party login integration, where a redirect URI or callback domain might be built dynamically rather than strictly validated against a pre-registered allowlist.
- Canonical link tags, Open Graph meta tags, and any other self-referential URL the application generates, since these frequently reuse the same header-reading code path as more sensitive link generation elsewhere in the application.
- Any endpoint behind a caching layer or CDN, identifiable through response headers like
X-Cache, CF-Cache-Status, or similar, since these are where a single successful poisoning attempt can affect many other users at once.
- Multi-tenant applications using the
Host header for routing, where a crafted value might reach an internal or unintended virtual host.
How to hunt it, step by step
Step 1: identify every feature that generates a link containing the application’s own domain. Password reset, email verification, invitation links, canonical URLs, OAuth redirect flows.
Step 2: test basic Host header replacement. Using a tool like Burp Repeater, change the Host header to a domain you control, attacker-controlled-test.com, on a password reset request for a test account you own, and check the resulting email for the embedded link’s domain.
Step 3: if the primary Host header is validated, test the secondary variants. Add X-Forwarded-Host, X-Host, or X-Forwarded-Server set to your controlled domain alongside a valid primary Host header, since some applications validate only the primary header while a downstream component still consults one of these for link generation.
Step 4: test port and protocol variations if a straightforward domain swap is rejected. Some validation logic checks the hostname correctly but not an unusual port appended to it, or accepts a technically matching domain with a different scheme, exactly the technique used in the Shopify themes case above.
Step 5: for OAuth and SSO flows specifically, test whether the Host header influences the redirect destination. Intercept the authentication flow, change the header, and check whether the resulting redirect URI or callback domain changes to match your injected value.
Step 6: for cache poisoning specifically, confirm caching behavior first. Check for cache-related response headers, then send a request with an injected header value and a unique, identifiable marker, followed by a clean request without authentication, to see whether your injected value or marker appears in the second response.
Step 7: always confirm against your own test account first, and never against a real victim. The safest, most convincing proof is your own password reset email showing a poisoned link, with a clear before-and-after comparison against the legitimate version.
Writing the host header injection report
Title: Host Header Injection in [feature] allows [password reset poisoning / OAuth redirect manipulation / cache poisoning]
Summary:
One sentence: which feature, which header, and what the
poisoned output was shown to contain.
Steps to Reproduce:
1. Intercept a request to [endpoint, e.g. password reset] for a
test account, and modify the Host header (or X-Forwarded-Host)
to [attacker-controlled-test-domain].
2. Observe that [the resulting email / OAuth redirect / cached
response] contains a link or reference pointing at the
injected domain rather than the application's real domain.
(Exact request showing the modified header, and the resulting
email, redirect, or cached response showing the injected domain,
using only your own test account.)
Impact:
The application builds security-sensitive URLs using the
client-supplied Host header rather than a fixed, server-controlled
value, allowing an attacker to poison [password reset links /
OAuth redirect destinations / cached responses] sent to a victim,
leading to [credential or token theft / account takeover /
denial of service for other users]. State the realistic worst
case your specific finding demonstrates.
Remediation:
Never use the client-supplied Host header, or related headers
such as X-Forwarded-Host, to construct security-sensitive URLs.
Use a fixed, server-side configured canonical hostname instead.
Where virtual hosting genuinely requires reading the Host header,
validate it against a strict allowlist of expected values before
using it for anything beyond basic routing.
Strong host header reports, the phpBB CVE and the independent password reset writeup especially, show a clean before-and-after comparison, the legitimate link’s domain versus the poisoned one, using only a test account the researcher controls, which is exactly what makes severity immediately clear to a triager without them needing to reconstruct the attack themselves.
What programs often reject
- Open redirect findings relying specifically on
X-Forwarded-Host, X-Host, or X-Server header manipulation, which a number of programs explicitly list as out of scope on their own policy pages, since the practical exploitability of this specific variant is frequently disputed
- Password reset or confirmation token leakage via the
Referer header to a trusted third party, which several programs also explicitly exclude as a distinct, separately scoped issue
- Findings with no actual demonstrated security-sensitive consequence, a header that gets reflected somewhere cosmetic with no real impact
- Reports performed against a real, non-consenting victim account rather than the researcher’s own test account
Always read the specific program’s policy page before investing time here. This bug class is unusually prone to being explicitly scoped out by name on individual programs, more so than most other classes in this series, precisely because the basic reflection is so easy to find and so often reported without a demonstrated real-world impact attached.
The mindset: not every header is infrastructure
This series keeps returning to the same question: does a boundary enforce what it claims to. The Host header’s entire reputation as “safe” comes from how it looks, a piece of HTTP plumbing describing which virtual host the client wants, rather than how it behaves, a value the client sets on every single request with complete freedom. Whenever an application’s own domain shows up somewhere dynamically generated, the only real question is where that value actually came from, and the honest answer is often: wherever the attacker just told it to.
Homework for Day 17
- From recon, list every feature that generates a link containing the application’s own domain, with special attention to password reset, email verification, and any OAuth or SSO flow.
- Test basic Host header replacement against each, using your own test account, and compare the resulting link or redirect against the legitimate version.
- If the primary header is validated, test
X-Forwarded-Host and similar secondary headers.
- Check for caching-related response headers on the target, and if present, test for cache poisoning using a unique marker value.
- Read the Periscope and Twitter OAuth takeover report and the phpBB CVE-2026-29199 writeup end to end. For each, note the exact code-level root cause, and compare how differently the impact played out, credential theft through a redirected OAuth flow versus a poisoned password reset link, from essentially the same underlying mistake.
A confirmed host header injection leading to password reset poisoning or OAuth redirect manipulation is typically high severity, since it usually leads directly to account takeover with minimal further steps. Document it with the before-and-after link comparison from your own test account, and recommend a fixed canonical hostname over trusting any client-supplied header.
Day 18 moves to a bug living in a line most developers paste without a second thought, CRLF Injection, and how a single injected newline can split one HTTP response into two.