PrivCaptcha.com

What Is SMS Pumping and How to Protect Your OTP Forms

SMS pumping is a fraud where bots fill in your phone verification form so your SMS provider sends one-time codes (OTPs) to numbers the attacker profits from. Each message costs you money and earns them a share. This guide shows how to spot it in your send logs and invoices, then gives you the defences in order, with code you can copy.

Sophie ParkerPublished · Updated · 11 min read
Smartphone OTP form sending a flood of paid SMS messages to numbers abroad, with a shield blocking SMS pumping
Key takeaways The short version, before the details.
  1. SMS pumping turns your OTP form into a source of income for fraudsters, and you pay for every message.
  2. The clearest signs are a falling verification rate, runs of similar numbers and traffic from countries you do not serve.
  3. Stop it with a country allowlist, per-number and per-session caps, resend delays and a challenge token checked on your server before each send. Your SMS provider's own limits are still your job to set.

What is SMS pumping?

SMS pumping happens when automated scripts submit phone numbers into any form that sends a text: sign-up verification, login codes, password resets, "send me the app link" boxes. Your app asks your SMS provider to deliver the message, and the provider bills you for it.

The numbers are not random. They belong to ranges where someone along the delivery chain collects a fee for every message that arrives. The attacker gets a cut of that fee. Nobody ever types the code back in, because nobody wanted it.

For you, the result looks like a normal busy day in your app and a very abnormal line on your SMS invoice.

The bills can get large. In February 2023, Elon Musk wrote on Twitter that the company was being scammed by phone companies for about $60M a year in fake 2FA SMS messages.

SMS toll fraud and IRSF fraud: how they relate

You will see several names for the same scheme. SMS toll fraud is the broad term for generating paid message traffic so someone can earn from the fees. IRSF fraud (international revenue share fraud) is the older telecom name, first used for voice calls to premium international numbers, where the fee is shared between the party that terminates the traffic and the fraudster. SMS traffic pumping and "artificially inflated traffic" describe the SMS version. Twilio's glossary entry on SMS pumping fraud covers the industry view.

How SMS traffic pumping works step by step

  1. The attacker finds a form that sends a text without asking much in return: no account, no challenge, no cap.
  2. They get access to a block of numbers where termination fees are high and a share flows back to them, often in countries you never sell to.
  3. A bot submits those numbers, usually in sequence (+X 555 0100, 0101, 0102...), from many IP addresses so per-IP limits stay quiet.
  4. Your app asks your provider to send each code, and your provider charges you per message.
  5. The fees are split between the parties in on the scheme. The codes are never entered.

The key point: the attacker does not need to break anything. Your form works exactly as designed. That is why the fix is to make each send cost the sender something and to limit where and how often you send.

SMS pumping vs SMS bombing and other SMS attacks

SMS pumping is often confused with other SMS attacks that abuse the same forms. The defences overlap, but the goal and the victim differ.

AttackWhat the attacker wantsWho is hurtTypical pattern
SMS pumpingA share of the message feesYou, through your SMS billMany different numbers, often in one range or country
SMS bombingTo flood one person's phoneThe owner of the number, then your sender reputationThe same number, many times in a short window
Fake sign-upsAccounts for spam, bonuses or resaleYour data and your usersCodes are entered, often with virtual numbers

The giveaway for pumping is the last column: codes go out but almost none come back. If codes are being entered at scale, you are more likely looking at fake sign-ups.

How to spot SMS pumping in logs and invoices

You usually notice SMS pumping on the invoice first. Your send logs tell you the same story earlier, if you look for these signs.

Warning signWhere to lookWhat it looks like
Low completion rateSends vs successful code checksSends go up while verified codes stay flat
Number rangesThe phone column of your send logNumbers that differ only in the last 2 to 4 digits
Unusual countriesDestination country per sendTraffic to countries where you have no customers
BurstsSends per minuteSpikes at night or outside your users' usual hours
Cost per message risingYour provider invoice by destinationTotal spend grows faster than message count

If you log each send and each successful verification, two queries show most of it. This one gives the completion rate per country for the last seven days (PostgreSQL syntax):

SELECT country,
       COUNT(*) AS sent,
       COUNT(verified_at) AS verified,
       ROUND(100.0 * COUNT(verified_at) / COUNT(*), 1) AS completion_pct
FROM otp_sends
WHERE created_at > now() - interval '7 days'
GROUP BY country
ORDER BY sent DESC;

And this one finds number ranges by grouping on everything except the last three digits:

SELECT LEFT(phone, LENGTH(phone) - 3) AS number_range,
       COUNT(*) AS sent,
       COUNT(verified_at) AS verified
FROM otp_sends
WHERE created_at > now() - interval '24 hours'
GROUP BY number_range
HAVING COUNT(*) >= 5
ORDER BY sent DESC;

A country with hundreds of sends and a completion rate near zero, or a range with dozens of sends and no verifications, is the pattern to act on.

If you do not store a verified_at time per send today, add it now. Completion rate is the single most useful number for catching SMS pumping, and you cannot compute it later from data you never saved.

Which SMS protection steps to add, in order

No single check stops SMS pumping. Each layer below removes a share of the abuse, and together they make each fake send slow and expensive. The examples use Node with Express and Redis, but the logic carries to any stack. The limits shown are starting points, not rules: set them from your own traffic.

Allow only the countries you serve

This is the cheapest and most effective step. If your customers are in four countries, there is no reason to send codes anywhere else. Parse the number properly instead of matching prefixes by hand; the libphonenumber-js package does this for Node.

const { parsePhoneNumberFromString } = require('libphonenumber-js');

const ALLOWED_COUNTRIES = new Set(['GB', 'IE', 'DE', 'FR']);

function normalisePhone(raw) {
  const phone = parsePhoneNumberFromString(String(raw || ''));
  if (!phone || !phone.isValid()) return null;
  if (!ALLOWED_COUNTRIES.has(phone.country)) return null;
  return phone.number; // E.164, for example +447700900123
}

Return the same generic error for a blocked country as for a bad number, so the bot learns nothing about your list.

Cap sends per number and per session

Pumping spreads across many numbers, and SMS bombing hammers one. A cap per number handles the second; a cap per session (and per account, if the user is signed in) slows the first. A small counter with an expiry is enough:

// Returns true while the counter is still under its limit.
async function underLimit(key, limit, windowSeconds) {
  const count = await redis.incr(key);
  if (count === 1) await redis.expire(key, windowSeconds);
  return count <= limit;
}

const okNumber  = await underLimit(`otp:num:${phone}`, 3, 3600);   // 3 per hour per number
const okSession = await underLimit(`otp:sess:${req.sessionID}`, 5, 3600); // 5 per hour per session

A global cap is worth adding as well: a daily ceiling on total sends, or on sends per country, that pages someone when it is reached. It turns a surprise invoice into an alert.

Add a delay before each resend

Real users wait for the text to arrive. Bots do not. A cooldown between sends to the same number, growing after each resend, costs a real person a few seconds and costs a bot most of its throughput.

const RESEND_DELAYS = [30, 60]; // seconds before the 2nd and 3rd send (the cap allows 3 per hour)

async function cooldownFree(phone) {
  const sent = Number(await redis.get(`otp:count:${phone}`)) || 0;
  const wait = RESEND_DELAYS[Math.min(sent, RESEND_DELAYS.length - 1)];
  // NX: only set if no cooldown is running. Returns null while one is.
  const ok = await redis.set(`otp:cool:${phone}`, '1', 'EX', wait, 'NX');
  if (ok) {
    const count = await redis.incr(`otp:count:${phone}`);
    if (count === 1) await redis.expire(`otp:count:${phone}`, 3600); // same 1-hour window as the cap
  }
  return ok !== null;
}

Show the countdown on the resend button so honest users know when they can try again.

Verify a challenge token before every send

Caps limit the damage; a challenge raises the price of each attempt. Put a challenge on the form, and have your server verify its token before it calls the SMS provider. A bot that has to solve a fresh challenge for every send can no longer fire thousands of requests cheaply.

With PrivCaptcha, the widget writes a token into a hidden privcaptcha-response field when the visitor solves the puzzle, and your backend redeems it through the siteverify endpoint. Three rules from that endpoint matter here:

  • Single use. A token verifies exactly once, so one solved puzzle buys one send. A resend needs a new solve.
  • 120 seconds. Verify the token in the request that sends the SMS, not in a background job.
  • Fail closed. The official SDKs return verification-unavailable on a timeout or network error instead of throwing. Treat that as "do not send".

On the page, call privcaptcha.reset() after each send or failed attempt, as described in the widget JavaScript API, so the resend button asks for a fresh solve:

async function sendCode(phone) {
  const res = await fetch('/otp/send', {
    method: 'POST',
    body: new URLSearchParams({
      phone: phone,
      'privcaptcha-response': privcaptcha.getResponse(),
    }),
  });
  privcaptcha.reset(); // the token is single-use, success or not
  return res.ok;
}

The solve itself includes a proof-of-work step that the visitor's browser computes, and a client that keeps failing gets harder puzzles. That is the cost a bot pays per token. The challenge does not know about your SMS traffic: it does not cap sends, read phone numbers or block countries. Those checks stay in your handler.

Make every OTP send cost a bot somethingSee how the proof-of-work challenge prices each attempt See how it works

How the checks fit in one OTP send handler

Order matters. Run the free, stateless checks first, then the challenge, then the resend delay, and only then the caps. If you count before the challenge, a bot can burn through a real user's per-number cap without solving anything, and if you count before the delay, a user who taps Resend too early uses up one of their sends and still gets no code.

const { verify } = require('./privcaptcha'); // the PrivCaptcha Node SDK file

app.post('/otp/send', async (req, res) => {
  const fail = () => res.status(400).json({ error: 'cannot_send_code' });

  // 1. Country allowlist and number format (no state, no cost)
  const phone = normalisePhone(req.body.phone);
  if (!phone) return fail();

  // 2. Challenge token, verified on the server, fail closed
  const check = await verify({
    secret: process.env.PRIVCAPTCHA_SECRET,
    response: req.body['privcaptcha-response'],
  });
  if (!check.success) return fail();

  // 3. Resend delay, before the caps so an early tap does not use up a send
  if (!(await cooldownFree(phone))) {
    return res.status(429).json({ error: 'wait_before_resend' });
  }

  // 4. Caps per number and per session
  if (!(await underLimit(`otp:num:${phone}`, 3, 3600))) return fail();
  if (!(await underLimit(`otp:sess:${req.sessionID}`, 5, 3600))) return fail();

  // 5. Only now pay for a message
  await sendOtp(phone);
  await logSend(phone, req.sessionID); // feeds the completion-rate query
  res.json({ ok: true });
});

Why SMS provider limits are still your job

Everything above runs in your app. Your SMS provider's account is a second line, and it is the one that caps the bill when your app has a bug or a new form ships without checks. No challenge or captcha service can set it for you.

  • Geographic permissions. Most providers let you switch off destinations per country. Mirror your allowlist there.
  • Spend limits and alerts. Set a daily or monthly budget alert low enough that a pumping night wakes you up, not a pumping month.
  • Rate limits and fraud filters. Turn on whatever your provider offers for verification traffic, and read what it actually blocks.
  • Separate keys per product. A leaked or abused key then affects one form, not every message you send.
A challenge raises the cost of each fake request. It does not cap what you spend. Keep the per-number, per-session and global caps in your code and the spend limits at your provider, even after you add a challenge.

What to do during an SMS pumping attack

  1. Block the destinations showing near-zero completion, in your provider console and in your allowlist.
  2. Lower the global send cap for the next 24 hours, even if some real users have to retry.
  3. Find every form that sends a text. Attackers move to the one you forgot: resend links, account recovery, invite flows.
  4. Add the challenge and the caps from this guide to each of them.
  5. Contact your provider with the dates, destinations and volumes. Ask what they can do about the charges; policies differ.

For the wider picture of automated abuse on web forms, the OWASP Automated Threats to Web Applications project lists the patterns and defences by name.

Ready to put a price on every OTP send?

  • A single-use token your server checks before it calls your SMS provider
  • A proof-of-work puzzle that gets harder for clients that keep failing
  • No visitor profiling: the score sets puzzle difficulty, not identity
Protect your forms

Frequently asked questions

SMS pumping is a fraud where bots submit phone numbers into forms that send texts, such as OTP or sign-up forms. You pay your SMS provider for each message, and the attacker earns a share of the fees on the numbers they control. The codes are never entered, so it shows up as cost without users.

Compare codes sent with codes verified. A sharp drop in completion rate is the main sign. Then look for numbers that differ only in their last few digits, sends to countries where you have no customers, bursts at odd hours and an SMS invoice growing faster than your sign-ups.

Layer your defences. Allow only the countries you serve, cap sends per number and per session, add growing delays between resends, and verify a single-use challenge token on your server before each send. Then set geographic permissions and spend alerts in your SMS provider's account as a backstop.

You do. Your SMS provider bills the account that requested the messages, and the requests came from your app. Some providers may review fraud cases, but their policies differ and nothing is guaranteed. That is why caps in your code and spend limits at the provider matter more than any refund.

No. A challenge makes each send cost the bot effort, and a single-use token stops it from reusing one solve for many sends. It does not limit countries, numbers or total spend. Keep the allowlist, caps and resend delays in your handler and the spend limits at your provider.