LeakyVibe

Guides · Updated 2026-11-04

SMS pumping: how to stop bots from running up your OTP bill (Supabase + Twilio)

Short answer: SMS pumping is when bots type phone numbers into your sign-in or verification form so your app sends one-time codes to numbers the attackers profit from. You pay for every message. Nothing is stolen, so it often shows up first on your bill. In a vibe-coded app the SMS is usually triggered straight from the browser with the public key, so anyone can call it without your form. The fixes: lower Supabase's SMS rate limit to what you really need, turn on CAPTCHA and pass the token with every OTP request, allow only the countries you serve in your SMS provider (Twilio Geo Permissions), turn on the provider's fraud protection (Twilio Verify Fraud Guard or SMS Pumping Protection), and set a usage alert.

Does your app have this problem? Free scan, 15 sec, no sign-up

or watch it scan our demo app ▶

What SMS pumping is, and why it costs you money

Twilio describes it like this: SMS pumping happens when fraudsters use a phone number field to get your app to send a one-time passcode (or a download link, or anything else) by SMS. The messages go to a range of numbers controlled by a specific mobile network operator, and the fraudsters get a share of the revenue (https://www.twilio.com/docs/verify/preventing-toll-fraud). A close cousin is toll fraud: the same trick with voice calls to premium-rate numbers.

The goal isn't to break into accounts. It's to make your app send as many paid messages as possible. So the usual signs are an SMS bill that jumps overnight, lots of codes sent to countries you don't serve, and almost none of those codes ever being entered.

Why vibe-coded apps are easy targets

AI tools usually wire phone sign-in like this: the browser calls supabase.auth.signInWithOtp({ phone }) with your public (anon or publishable) key. That key is public by design, so the SMS endpoint behind it, /auth/v1/otp, can be called by anyone with a short script. Supabase's own docs show the curl version (https://supabase.com/docs/guides/auth/phone-login).

That means anything you only do in the form (a "wait 60 seconds" timer, a country dropdown, a disabled button) doesn't stop a bot. The limits that count are the ones enforced by Supabase or by your SMS provider. Supabase's phone sign-in page says it directly: to keep SMS costs under control, adjust your project's rate limits and configure CAPTCHA.

1. Lower Supabase's SMS rate limit (2 minutes)

Open Authentication > Rate Limits in the Supabase dashboard. Per Supabase's rate limit docs (https://supabase.com/docs/guides/auth/rate-limits), the defaults include:

  • SMS messages sent by Supabase Auth: 30 per hour for the whole project (customizable).
  • Sign-ups and sign-ins, including /auth/v1/otp: 30 requests per 5 minutes per IP address, with bursts up to 30.
  • Sending an OTP to the same user: one request per 60-second window.

The per-project SMS limit is your spending cap: it limits how many codes can go out per hour no matter how many IPs a bot uses. Set it close to what your real traffic needs, with some headroom. When it's reached, Supabase returns 429 Too Many Requests, so real users are blocked too while the limit is hit. That's the tradeoff, and it's usually far cheaper than an unlimited bill.

If your server calls Supabase Auth for users (for example through an API route), Supabase sees your server's IP, not the user's. The docs explain how to forward the real IP with the Sb-Forwarded-For header and a secret key, after turning on IP address forwarding in the same settings page.

2. Turn on CAPTCHA and send the token with each OTP request

Supabase Auth supports hCaptcha and Cloudflare Turnstile (https://supabase.com/docs/guides/auth/auth-captcha). Turn it on under Authentication > Bot and Abuse Protection > Enable CAPTCHA protection, choose the provider and paste its secret key. Because Supabase holds the secret, the token is checked on Supabase's side, not just in your form.

Then add the CAPTCHA widget to your phone form and pass its token with the request. supabase-js accepts captchaToken in the options of signInWithOtp, including for phone:

const { error } = await supabase.auth.signInWithOtp({
  phone,
  options: { captchaToken },
})
// reset the widget after each attempt so a token isn't reused

Twilio gives the same advice from its side: CAPTCHAs and bot detection help deter automated scripts (https://www.twilio.com/docs/verify/preventing-toll-fraud).

3. Only allow the countries you actually serve

This is often the single biggest fix, because pumping relies on sending to expensive destinations. In Twilio, SMS Geo Permissions control which countries you can send SMS to (https://www.twilio.com/docs/messaging/guides/sms-geo-permissions):

  • Go to Console > Messaging > Settings > Geo Permissions and untick every country you don't serve. Twilio marks some countries as High Risk for SMS pumping.
  • Changes take effect immediately; messages to a disabled country fail with error 21408.
  • A new Twilio account only allows your home country by default, so check whether you (or your AI tool's setup steps) enabled more.
  • If you use Twilio Verify, review Verify Geographic Permissions too and disable the countries you don't plan to send to.

Using another SMS provider through Supabase (MessageBird, Vonage, TextLocal)? Look for the equivalent destination-country setting in that provider's dashboard.

4. Turn on your provider's fraud protection

Twilio is clear that no provider-side protection is 100% effective, so keep the rate limits and CAPTCHA from steps 1 and 2 as well.

5. Watch the numbers and set an alert

  • Track your OTP conversion rate: codes entered correctly divided by codes sent. Twilio suggests alerting when it drops, especially for an unexpected country.
  • Add a usage trigger in your Twilio account so you get an email when spend passes a threshold, instead of finding out from the invoice.
  • Optionally, look up the number type before sending and only send SMS to mobile numbers (Twilio Lookup), and add growing delays between retries to the same number.

If you send SMS from your own code

Some apps skip Supabase phone auth and call Twilio from an API route or Edge Function. Then all of the above is your job:

  • Keep the Twilio auth token in server environment variables only. Never in browser code, and never in a NEXT_PUBLIC_ or VITE_ variable.
  • Require a CAPTCHA token and verify it on the server before sending.
  • Rate limit per IP, per phone number and per number prefix, and refuse countries you don't serve before calling the provider.
  • Don't let the route send any text to any number. It should only send your own code message.

With Supabase Auth you can also use the Send SMS Hook, which replaces Supabase's built-in SMS sending with your own function (https://supabase.com/docs/guides/auth/auth-hooks/send-sms-hook). Supabase's example reads the country code from the phone number to pick a channel; the same spot is where you can refuse countries you don't serve.

Under attack right now?

  1. Lower the SMS limit in Supabase Authentication > Rate Limits (or temporarily disable the Phone provider if you can live without it).
  2. Disable every country you don't serve in Twilio Geo Permissions.
  3. Turn on Verify Fraud Guard or SMS Pumping Protection.
  4. Turn on CAPTCHA and ship the captchaToken change.
  5. Contact your provider. Twilio asks you to email fraud@twilio.com with your Account SID, product, date/time range, destination countries and a description of the activity.

Quick checklist

  1. SMS rate limit in Supabase set close to your real traffic.
  2. CAPTCHA on, captchaToken passed in every signInWithOtp call.
  3. Only the countries you serve enabled in Twilio Geo Permissions (or your provider's equivalent).
  4. Verify Fraud Guard or SMS Pumping Protection turned on; unused voice channel off.
  5. Usage alert set in your SMS provider.
  6. SMS provider secrets only on the server.

The free LeakyVibe scan at the top of this page checks your live site from the outside for secret keys in public JavaScript, Supabase tables that answer the public key, and missing security headers. It does not test your SMS or OTP flow and can't see your Supabase or Twilio settings, so use the checklist above for that.

Related: if a key has already leaked, start here: https://leakyvibe.com/guides/leaked-api-key-what-to-do

Official sources (checked 2026-11-04): Supabase, "Phone sign-in" (https://supabase.com/docs/guides/auth/phone-login), "Rate limits" (https://supabase.com/docs/guides/auth/rate-limits), "Enable CAPTCHA Protection" (https://supabase.com/docs/guides/auth/auth-captcha), "Send SMS Hook" (https://supabase.com/docs/guides/auth/auth-hooks/send-sms-hook), supabase-js auth types (signInWithOtp captchaToken option, github.com/supabase/supabase-js); Twilio, "Preventing Fraud in Verify" (https://www.twilio.com/docs/verify/preventing-toll-fraud), "SMS Pumping Protection for Programmable Messaging" (https://www.twilio.com/docs/messaging/features/sms-pumping-protection-programmable-messaging), "SMS Geo Permissions" (https://www.twilio.com/docs/messaging/guides/sms-geo-permissions).

Check your app for this now

Free scan · about 15 seconds · no sign-up

Passive, read-only checks. Only scan apps you own or have permission to test.