CSRF Token Bypass in Account Deletion
The CSRF token used for account deletion was not tied to the user session, so a token from one account could be used to delete another account. An attacker could craft a self-submitting form to delete a logged-in victim's account.
- Triaged in 16 days
- Fixed in 3 months
- Disclosed after 5 months
The authentication token authenticity_token used in the POST request for deleting an account can be bypassed, by replacing the same with a token generated for deleting another account. This way, a self submitting form can be used to delete another user's account as long as he/she's logged in.
Steps to Reproduce:
- Create an account and copy the POST request for deleting it.
POST /users HTTP/1.1
Host: gitlab.com
Referer: https://gitlab.com/profile/account
Cookie: _gitlab_session=1staccount_cookie;
Content-Type: application/x-www-form-urlencoded
_method=delete&authenticity_token=auth_1staccount
- Create another account and send the above request after replacing the
_gitlab_sessioncookie with that of the new one. Theauthenticity_tokenremains the same as that of the first account. - Send the request and the new account gets deleted.
I have not explored all possible scenarios like different IP addresses or something. But the above situation, where I used accounts created using emails from a temporary email address generator, was reproduced multiple times.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the server validated the CSRF token's existence but did not bind it to the user session, so any valid token was accepted for any account.
What the attacker needed
Victim is logged in; victim submits a crafted form; attacker has a valid CSRF token
How it was found
- Create an account and capture the POST request used to delete it.
- Create a second account and replace the session cookie in the captured request with the second account's cookie, keeping the first account's token.
- Send the request and observe that the second account is deleted.
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 report has not been written yet. The Original tab links to the source.
Websites use a secret token to make sure a form submission really came from their own site and not from an attacker's page. Here, the token was not checked against the specific user, so a token from one account worked for another. That let an attacker trick a logged-in user into deleting their own account.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.