⚔️ How I Hijacked Password Reset Links with One Sneaky Header Injection
The password reset endpoint trusted the Origin header to build the reset link, and a crafted Origin value ending with a question mark bypassed the domain check. An attacker could send a reset email whose link pointed to their own server, capturing the token and taking over the victim's account.
Sometimes the smallest oversights can lead to some of the most dangerous vulnerabilities. In this write-up, I’ll walk you through how I managed to hijack password reset tokens simply by tweaking the Origin header.
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 server used the user-controlled Origin header to construct the password reset URL and validated it with a naive suffix check that a trailing question mark could bypass.
Impact
An attacker could hijack password reset flows and gain full access to any account, though the victim had to click the malicious reset link.
What the attacker needed
Victim's email address; victim clicks the reset link; attacker-controlled server
The fix
The issue was fixed; developers should use the server name rather than the Origin header and enforce strict allow-lists for redirect domains.
How it was found
- Click 'Forgot Password' and enter the victim's email address.
- Intercept the outgoing POST request to the password reset endpoint.
- Change the Origin header to a value ending with a question mark followed by the target domain.
- Observe the server responds with 200 OK.
- The victim receives a reset email whose link points to the attacker's server and includes the token.
- When the victim clicks the link, the attacker receives the reset token and can take over the account.
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 emails you a special link that lets you set a new one. This site decided where to send that link by looking at a header the browser sends, called Origin, which can be faked. By adding a question mark to a fake address, the attacker tricked the site into emailing the victim a link that went to the attacker's own server, so the attacker got the secret code and could 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.