How I Found a CSRF Vulnerability Leading to Account Takeover ($2,000 Bounty)
The password reset endpoint accepted POST requests without any CSRF token or origin validation, so a page hosted by an attacker could silently change a logged-in user's password. An attacker who lured a victim to that page could therefore take over the victim's account.
Published on medium.com
On July 14, 2021, while testing the security of a web application, one of my private bug bounty programs on hackerone, I discovered a critical Cross-Site Request Forgery (CSRF) vulnerability in the password reset functionality. This vulnerability allowed an attacker to take over any user’s account by forcing them to…
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
The password reset endpoint changed state on a POST request without a CSRF token or any check of the request's origin.
Impact
An attacker could take over any user's account by getting the victim to visit a malicious page while logged in, with no interaction beyond that visit.
What the attacker needed
Victim is logged in to the site; victim visits an attacker-controlled page; attacker knows the reset request format
The fix
The report says the issue was resolved after the researcher recommended CSRF tokens, SameSite cookies, Origin and Referer checks, and re-authentication for sensitive actions.
How it was found
- Log in to a first test account and start a password reset with a new password.
- Capture the reset request in Burp Suite before it is sent.
- Generate a CSRF proof-of-concept page from that request and save it as an HTML file.
- Log in to a second test account in a different browser.
- Open the saved HTML file in that browser.
- Observe that the second account's password was changed without further verification.
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 log in to a website, your browser stores a cookie that proves who you are, and it sends that cookie with every request to the site. A cross-site request forgery (CSRF) attack is a page on another site that quietly makes your browser send a request to the vulnerable site, and because the cookie goes along with it, the site treats the request as yours. Here the request was a password change, so the attacker could set a new password on your account without knowing the old one.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.