Interesting Case of CSRF in [Redacted]
A GET request to a user settings URL with a confirmation parameter deletes the account without CSRF protection, despite the API endpoint being protected. An attacker could trick a logged-in victim into visiting a malicious link or page to delete their account.
medium.com
Published on medium.com
In [Redacted].com, CSRF protection is enforced using the X-CSRF-Token header on all sensitive endpoints, making exploitation difficult. However, I discovered a way to bypass this protection and delete user accounts.
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 account deletion confirmation page performs a state-changing action on a GET request without verifying a CSRF token, unlike the underlying API endpoint.
Impact
An attacker could delete a victim's account if the victim is tricked into visiting a malicious link within 15 minutes of logging in; after that, the request redirects to a password confirmation page, preventing automatic deletion.
What the attacker needed
Victim is logged in; attack within 15 minutes of login; victim clicks a link or loads a page
The fix
The account deletion confirmation page should require a valid CSRF token or use a POST request with CSRF protection, similar to the API endpoint.
How it was found
- The attacker crafts a malicious link or webpage that sends a GET request to the account deletion URL with the confirmation parameter.
- The attacker tricks a logged-in victim into clicking the link or loading the page.
- The victim's browser sends the request, and the account is deleted automatically.
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 (Cross-Site Request Forgery) is when a malicious website makes a logged-in user's browser send a request to another site without the user's knowledge. Here, a simple link could delete the user's account because the deletion page did not check that the request came from the real site.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.