In-depth lesson · Host header injection
Tips for beginners
Every point the Host header injection reports back under this heading, best-backed first, each with the reports it is seen in.
-
If a simple Host header change is blocked, try the bypasses shown in the reports: a second Host header, a trailing full stop, a question mark in the Host header, a value containing localhost to satisfy a substring check, an IDN homograph, or the target domain as a prefix of your own domain. Also try reaching the origin server directly if a CDN is in front, since the origin may still trust the Host header.
Seen in 9 reports
-
Try host-like headers one at a time on the reset request: X-Forwarded-Host, X-Host, X-Server, X-Forwarded-For, Referer, Origin. Watch which one changes the link. Do not send them all at once, because you will not know which one worked. The reports show X-Forwarded-Host is the most common, but others appear too.
Seen in 8 reports
-
Start with the forgot-password form on your own account. Request a reset and look at the emailed link. If the base domain matches the Host header you sent, try changing the Host header or adding X-Forwarded-Host and request another reset. This is the simplest test and it is where most of the reports here begin.
Seen in 6 reports
-
Check other flows that send links: email verification after signup, OAuth login redirects, quick-login links from websocket requests, and session cookie Domain attributes. The same trust mistake appears in all of these, and some are less tested than password resets.
Seen in 4 reports
-
Show impact, not just reflection. A changed link in an email is not enough on its own. Demonstrate that the token arrives at your server when the link is clicked, that the OAuth token and verifier arrive at your server, that the cookie Domain changes to a domain you control, or that the 2FA check is skipped. If you cannot show impact, say so and describe what you observed.
Seen in 4 reports
-
Look beyond the Host header. Check whether the reset link is built from a user-supplied redirect parameter, whether a 'to' parameter in the reset API is reflected into the link, and whether an internal open redirect can be chained into the reset link. These variants appear in the reports and are easy to miss if you only test the Host header.
Seen in 3 reports
-
Stay in scope. Check the program's scope before testing subdomains, beta environments, origin servers or third-party services. A beta subdomain that skips 2FA may be out of scope, and reaching an origin server behind a CDN may be against the rules. Reporting something out of scope wastes time and can get you removed from the program.
Seen in 3 reports
-
Do not report a Host header reflection with no impact. A page title or meta tag that reflects the Host header is not a vulnerability by itself. The reports here show reflection leading to cache poisoning or reset link poisoning, but you need to demonstrate the consequence. If you only see reflection, keep testing or do not report.
Seen in 3 reports
-
Check IP-based restrictions and 2FA checks. Spoof X-Forwarded-For with varying addresses to get past IP-based OTP rate limiting and brute-force the code, or to reach admin pages restricted by IP. Change the Host header to a beta subdomain on the login request and submit an arbitrary 2FA code to see whether the check is skipped. These are related trust mistakes that can lead to takeover.
-
Consider related network and platform issues if the program covers them. IPv6 router advertisements and WPAD with LDAP signing not enforced can allow NTLM relay. A media upload blacklist that does not include the .html extension can allow stored script and escalation to super admin. These are not Host header injection, but they appear in the same evidence and may be in scope.
-
Check the reset code itself. Remove the redirect URL parameter and see whether the generated code becomes a weak six-digit number. Send many reset requests and see whether old codes stay valid, letting you brute-force one within the window. Check whether the rate limit trusts a client-supplied forwarding header. These are separate weaknesses that can combine with host injection.
Seen in 1 report
-
Check whether the reset flow acts on an email address without proving the requester owns the account. This can allow a lockout or other disruption even without a poisoned link. It is a lower-impact finding, but it is worth noting if you cannot show takeover.
Seen in 1 report
-
Check email header injection separately. Inject encoded newline characters into the email field on the reset form and see whether you can add a BCC address and receive the reset email. This is a different root cause from host injection but often sits on the same form.
Seen in 1 report
-
Check whether the fix is complete. After a host fix, check whether the path portion of the emailed login or reset link is still attacker-controlled. A partial fix that only validates the host can leave the path injectable, as one report shows.
Seen in 1 report