One Column, Full Admin: A Supabase Row-Level Security Story
A Supabase row-level security policy let any signed-in user update their own profile row, but did not restrict which columns could be changed. By sending a direct API request that included a role field, an ordinary user could make themselves an administrator and also unlock paid subscription features.
There’s something strangely beautiful and equally alarming about finding a simple vulnerability which requires no buffer overflow… no obscure, technology-savvy cryptographic attack(s)… and no 3:00 A.M. blood sacrifice to the ancient, decrepit, all-but-forgotten cyber gods of old.
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 row-level security policy allowed users to update their own row without limiting which columns they could modify, so sensitive fields like role and subscription tier were client-writable.
Impact
An ordinary user could grant themselves full admin access and unlock paid features without paying, because the admin routes trusted the database role value without a second check.
What the attacker needed
A free account; ability to send direct API requests
The fix
The database should revoke broad update rights and grant update only on harmless columns, move roles into a separate table, re-check privileges server-side, and derive paid status from verified payment records.
How it was found
- Sign in as an ordinary user and obtain a valid token.
- Send a direct update request to the profiles endpoint for your own user id.
- Include a role field set to admin in the request body.
- Observe that the request succeeds and the account now has admin access.
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.
Row-level security is a database feature that decides which rows of data each user may read or change. Here it checked that the row belonged to the user but not which fields inside that row they could edit, so a user could change a field that sets their permission level. Because the app trusted that field, the user became an administrator.
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.