In-depth lesson · Host header injection
Typical fixes
Every point the Host header injection reports back under this heading, best-backed first, each with the reports it is seen in.
-
Build reset links from a fixed, server-configured domain rather than any request header.
Seen in 13 reports
-
Validate the Host and X-Forwarded-Host headers against an allowlist of expected domains.
Seen in 10 reports
-
Only accept X-Forwarded-Host from a trusted proxy.
Seen in 1 report
-
Anchor host validation regexes at the end and match the exact domain.
Seen in 1 report
-
Canonicalise and validate hostnames so IDN homographs are rejected.
Seen in 1 report
-
Do not set the cookie Domain attribute from the request Host header.
Seen in 1 report
-
Invalidate old reset codes and use a fixed code strength regardless of request parameters.
Seen in 1 report
-
Do not trust X-Forwarded-For for rate limiting unless the request comes from a trusted proxy.
Seen in 1 report
-
Strip newline characters from user-supplied email addresses before inserting them into email headers.
Seen in 1 report
-
Block the .html extension in media uploads.
-
Disable IPv6 router advertisements and WPAD, and enforce LDAP signing and channel binding.
Seen in 1 report
-
Do not accept a visible sender address as proof of account ownership.
Seen in 1 report