medium · M3 · MASVS-AUTH-2 · PTKD-LIVE-SUPABASE-RPC-EXPOSED
Database functions callable with the public key
The REST schema served to the anon key lists database functions under /rpc/. Anyone with the app can call them with arguments of their choice; a SECURITY DEFINER function skips RLS entirely.
How it is exploited
The attacker reads the function list from GET /rest/v1/ and calls POST /rest/v1/rpc/admin_reset_credits with any user id.
Why it matters
Business logic and data changes reachable by anyone, often without the checks the app UI performs.
How to fix it
- Review each listed function: who should call it?
- Revoke execute from anon/public for internal ones.
- Set search_path and check auth.uid() in the rest.
Does your app have this?
PTKD checks your build or your source project for PTKD-LIVE-SUPABASE-RPC-EXPOSED and every other check in this knowledge base.
Scan your appReferences
Related checks (M3)
- Permissive CORS with credentials
- State-changing request succeeded without authentication
- Weak JWT observed on the wire
- Biometric authentication not bound to a cryptographic key
- Premium access is stored on the phone and trusted (heuristic)
- Firebase rules trust an email address nobody verified
- Firebase security rules open to everyone
- Users can make themselves admin or premium in Firestore