Awesome host header injection worth 2k
The application reflected the Host header value into emails sent to users, allowing an attacker to inject HTML. After an initial fix blocked obvious hostnames, the author bypassed it using a query-string trick and an anchor tag to replace the original host with a malicious link.
Published on medium.com
Hello guy’s i hope you’re doing great in this story i will be covering beautiful/challenging host header injection.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application used the untrusted Host header value directly in email content without validation or encoding, and the first fix only blocked certain hostnames rather than sanitising the value.
Impact
An attacker could inject a link into emails sent by the application, potentially directing recipients to a malicious site; the text does not claim account takeover or other direct compromise.
What the attacker needed
Ability to send requests with a custom Host header; application sends emails containing the Host value
The fix
The application should validate the Host header against an allowlist and HTML-encode any value placed into emails, rather than relying on blocking specific hostnames.
How it was found
- Send a request with a Host header containing a query string and HTML markup.
- Observe that the value after the question mark is reflected in the email.
- Craft a Host header that closes the original host and injects an anchor tag pointing to an attacker-controlled domain.
- Trigger the email and confirm the malicious link replaces the original host.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When a website builds a link or email using the address the browser sends (the Host header), it should not trust that address. Here the site put the attacker's text straight into an email, so the attacker could make the email contain a link to their own site. That can trick users into clicking a fake link.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.