From a Simple CSRF to Full Account Takeover
The email verification endpoint accepted state-changing requests without CSRF protection, allowed GET requests, and did not validate Origin or Referer. An attacker could trick a logged-in victim into visiting a malicious page, which would change the victim's account email to an attacker-controlled address, enabling a full account takeover via password reset.
Published on medium.com
Security researchers often say that “small bugs become big bugs when chained together.” This case was a perfect example of that.
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 endpoint lacked CSRF tokens, accepted GET requests for state-changing actions, and did not validate the Origin or Referer headers.
Impact
An attacker could change a victim's account email to an attacker-controlled address and then use password reset to achieve full account takeover.
What the attacker needed
Victim is logged in; victim visits attacker page; attacker has an account
The fix
The endpoint should enforce per-session CSRF tokens, reject GET requests for state-changing actions, validate Origin and Referer headers, and require password confirmation before changing critical account information.
How it was found
- Create an attacker account and a victim account, each authenticated in separate sessions.
- In the attacker account, go to Settings, edit the email field, enter another attacker-controlled email, and click Resend Email while capturing the request with a proxy.
- Modify the captured request: change the content type to form-urlencoded, convert the JSON body to URL parameters, and switch the method from POST to GET.
- Host an HTML page containing a form that submits a GET request to the email-verify endpoint with the attacker's email.
- Log in as the victim and visit the malicious page; the platform processes the request using the victim's session cookies and sends a verification email to the attacker's mailbox.
- Open the verification link, then use the 'Forgot Password' feature on the victim's account to complete the account takeover.
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.
CSRF is when a malicious website makes your browser send a request to another site where you are logged in, without you knowing. Here, the email-change endpoint did not check that the request came from the real site, so an attacker could silently change your account email to theirs. They then used the 'forgot password' feature to take over your account.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.