Host Header Injection
Host Header injection
The HTTP Host header is a mandatory request header introduced in HTTP/1.1.
Example
GET /page HTTP/1.1
Host: example.comTesting Steps:
Suppl an Arbitrary Host Header
Send arequest
GET /page HTTP/1.1
Host: malicious-domain.comCheck for flawed Validation
GET /page HTTP/1.1
Host: example.com:bad-portSend Ambiguous Requests
Duplicate Host
GET /page HTTP/1.1
Host: example.com:bad-port
Host: t.example.com:bad-portAbsolute URL:
GET https://example.com/page HTTP/1.1
Host: bad-stuff-hereInject Host Override Headers
Use header like X-Forwarded-Host
GET /page HTTP/1.1
Host: example.com
X-Forwarded-Host: malicious-domain.comCommon Attack Vectors
Password Reset Poisoning: Manipulate the
Hostheader to redirect password reset links to an attacker-controlled domain.Host Header Authentication Bypass: Exploit improper header handling to bypass authentication mechanisms.
Web Cache Poisoning: Inject malicious content into a web cache using a forged
Hostheader.Routing-Based SSRF: Use the
Hostheader to manipulate server routing and access internal systems.
Mitigation and Prevention
Avoid Using the Host Header
Validate the Host Header
Disable Host Override Headers
Whitelist Domains for Routing
Last updated