How I Chained 3 Vulnerabilities for Complete Account Takeover
The Supabase userDetails table lacked Row-Level Security, so any authenticated user could read all user records, including plaintext verification codes. An attacker could trigger a password reset, read the OTP from the database, reset the victim's password, and then bypass 2FA because the login OTP was returned in the API response, achieving full account takeover including admin accounts.
medium.com
Published on medium.com
During a recent security assessment, I discovered a critical vulnerability chain that allowed complete account takeover of any user in the system — including administrators — without requiring access to the victim’s email. This case study demonstrates how multiple seemingly minor security oversights can combine 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
Likely missing Row-Level Security on the Supabase table combined with storing and returning one-time passwords in API responses.
Impact
Any user account, including administrators, could be fully taken over without access to the victim's email, and the attack could be automated to compromise all users.
What the attacker needed
A free account; victim's email address (obtainable from the leak)
The fix
The report states the vulnerabilities were remediated; recommended fixes include enabling Row-Level Security, removing verification codes from API responses, and enforcing server-side authorization.
How it was found
- Log in as a normal user and intercept the API request to the userDetails endpoint.
- Change the Accept header from the single-object format to standard JSON to receive all user records.
- Trigger a password reset for the victim's email address.
- Re-query the userDetails endpoint filtered by the victim's email to read the new verification code.
- Submit the leaked code to the confirm-reset endpoint with a new password.
- Attempt login with the new password and read the 2FA OTP from the send-verification-email response body to complete login.
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.
The app stored user data in a database service called Supabase but forgot to turn on its built-in access rules, so any logged-in user could read everyone's records. Those records included secret codes meant to prove you own an email address. By requesting a password reset and then reading the secret code from the database, an attacker could change anyone's password and log in as them, even if two-factor authentication was on.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.