Password Reset Poisoning via Dangling Markup
The application reflected the unsanitised Host header into the HTML of password reset emails, allowing an attacker to inject dangling markup. By manipulating the Host header, an attacker could cause the victim's reset email to load an external resource, potentially leaking the reset token and leading to account takeover.
medium.com
Published on medium.com
Password reset poisoning via dangling markup is a subtle yet dangerous vulnerability where an attacker manipulates HTTP headers, particularly the Host header to inject unsanitized input into HTML templates that are used in password reset emails.
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 inserted the Host header into the HTML of the reset email without proper escaping, allowing an attacker to break out of an attribute and inject dangling markup.
Impact
An attacker could take over user accounts by causing the victim's password reset email to load an external resource, potentially leaking the reset token.
What the attacker needed
Victim triggers password reset; attacker can intercept and modify requests; attacker has a server to receive callbacks
The fix
The application should properly validate and sanitise the Host header, and HTML-escape any user-controlled input placed into email templates.
How it was found
- Open the lab and submit a password reset request for the user wiener.
- Inspect the raw HTML of the reset email in the email client.
- Intercept the password reset request with a proxy and send it to Repeater.
- Modify the Host header to include a port number and resend the request.
- Check the email again to confirm the port is reflected in the reset link.
- Modify the Host header to inject malformed HTML that creates a dangling image tag pointing to a Collaborator server, and resend.
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 request a password reset, the website sends you an email with a special link. This report shows that the website used a value from the request (the Host header) to build that link without cleaning it. An attacker could change that value to include extra HTML, so the victim's email would secretly send the reset link to the attacker, letting the attacker 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.