high · M3 · MASVS-AUTH-2 · PTKD-VC-WEBHOOK-UNVERIFIED
Payment webhook handler without signature verification
A server or edge function handles Stripe, RevenueCat, Lemon Squeezy or Paddle webhooks but never verifies the signature. Anyone who finds the URL can post a fake 'payment succeeded' event and unlock paid features or credit accounts.
How it is exploited
An attacker posts a hand-written checkout.session.completed event to https://<ref>.supabase.co/functions/v1/stripe-webhook. The handler never checks the signature, so it marks the attacker's account as paid.
Why it matters
Free access to paid features, credits added to any account, and wrong revenue numbers.
How to fix it
- Read the raw request body (not parsed JSON) and verify the signature before doing anything.
- Stripe: stripe.webhooks.constructEvent (constructEventAsync in Deno) with the endpoint's signing secret. RevenueCat, Paddle, Lemon Squeezy: compare their HMAC or auth header in constant time.
- Reject unsigned or stale events with 400, and make the handler idempotent (store the event id).
TypeScript (Deno edge function)
const body = await req.text();
const sig = req.headers.get("stripe-signature")!;
const event = await stripe.webhooks.constructEventAsync(body, sig, Deno.env.get("STRIPE_WEBHOOK_SECRET")!);Does your app have this?
PTKD checks your build or your source project for PTKD-VC-WEBHOOK-UNVERIFIED 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