How I Hacked Accounts Using Host Header Injection in Password Reset Link — $$
The password reset link was built using the user-supplied Host header without validation, so an attacker could change the Host header to a domain they control and the reset email would contain a link to that domain. An attacker could then capture the reset token and take over the victim's account.
infosecwriteups.com
Published on infosecwriteups.com
I am Pratik Dabhi, a Bug Bounty Hunter and a Penetration Tester. Many of you may already know me, but for those who aren’t, please visit my website to learn more about me.
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 Host header from the request to construct the password reset link without validating it against a trusted domain.
Impact
Attackers could fully take over a user's account by capturing and using the poisoned password reset link, allowing them to change the victim's password and lock them out.
What the attacker needed
Victim has an account; attacker can send a request with modified Host header; victim clicks the reset link
The fix
Applications should not rely on the Host header from the user request when creating password reset links; instead, they should use a secure, server-side configuration like SERVER_NAME, or validate the Host header against a list of trusted domains.
How it was found
- Open the 'Forgot Password' page on the account subdomain.
- Enter a test email address and submit the form.
- Capture the POST request in Burp Suite.
- Send the request to Repeater and modify the Host header to a different domain.
- Send the modified request.
- Check the email; the reset link points to the modified domain.
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 you forget your password, a website sends you a link to reset it. That link is usually built using the website's own address. If the website instead uses the address supplied by the person making the request (the Host header), an attacker can change that address to their own site. Then the victim receives a reset link pointing to the attacker's site, and the attacker can steal the reset token and take over the account.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.