Cross-Site Request Forgery Leading to Account Takeover
The email change endpoint lacked CSRF protection, allowing an attacker to force a logged-in victim to change their email to one controlled by the attacker. The attacker could then trigger a password reset and take over the account.
medium.com
Published on medium.com
My name is Montaser Mohsen.I am a security researcher focused on web application vulnerabilities and account takeover scenarios.I pay close attention to business logic flaws that appear simple but create high impact.This write-up explains a Cross-Site Request Forgery vulnerability that led to full Account Takeover.For…
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 email change endpoint did not validate a CSRF token, did not verify Origin or Referer headers, and did not require re-authentication, so it trusted any request carrying the victim's session cookie.
Impact
An attacker could achieve full account takeover by silently changing the victim's email and then resetting the password, though the attack required the victim to visit a malicious page while logged in.
What the attacker needed
Victim logged in; victim visits attacker page
The fix
The issue was fixed by adding server-side CSRF token validation, requiring re-authentication before email changes, and implementing additional verification controls.
How it was found
- Log in as a normal user.
- While authenticated, visit an attacker-controlled webpage containing the malicious form.
- The request is automatically submitted.
- The email address is changed to [redacted]
- The attacker initiates a password reset.
- The reset link is sent to the attacker’s email.
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.
This is a cross-site request forgery (CSRF) bug. When you are logged into a website, your browser automatically sends your session cookie with every request to that site. An attacker can make your browser send a request you did not intend, like changing your email address, because the site does not check for a special token that proves the request came from its own pages.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.