How I Found a Critical Bug That Exposed Every User’s PII With a Free Account
A Supabase profiles table had a row-level security policy that only checked whether a user was logged in, not which user they were. Any freshly created free account could read every user's email, phone number, full name and business name in a single API call.
Yesterday, during a private penetration test, I signed up for a free account on a SaaS platform, sent one API request, and got back the email, phone number, full name, and business name of every single user on the platform.
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 on the profiles table used a condition that only tested whether the caller was authenticated, rather than comparing the row's owner to the caller's identity.
Impact
An attacker with any free account could harvest the full user base's personal data, enabling phishing, smishing, competitive scraping and a reportable data breach; the text notes no rate limiting or pagination barrier limited it.
What the attacker needed
A free account; no admin access needed
The fix
The policy was replaced with one that compares the row's id to the caller's auth.uid(), optionally also allowing workspace members, so users can only read their own or their workspace's rows.
How it was found
- Sign up for a free low-privilege account on the platform.
- Send a single REST request to the profiles table selecting all columns, using the account's API key and bearer token.
- Observe the response containing every user's email, phone number, full name and business name.
- Confirm the total row count via the Content-Range response header.
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.
A database can be told to show each person only their own row of data. Here the rule only asked 'is this person signed in?' and never asked 'is this their row?', so anyone with a free account could download the whole user list.
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.