Denial of wallet

Protect your app from a denial of wallet attack on Cloudflare, Vercel and Twilio

Costbrake checks Cloudflare, Vercel and Twilio spend every 5 minutes on Pro and alerts you when an hour runs past 3 times its usual cost and at least $5 over it, then checks every 1 to 2 minutes for the next 2 hours. A flood of requests or pumped SMS that costs real money shows up as that spike, whatever the source.

From the alert, an admin can put a Vercel project behind Attack Challenge Mode, cap a Cloudflare Worker's CPU, block Workers spend on the account or suspend a Twilio subaccount. Each brake is one click with a typed confirmation, and each has an undo.

What a flood of traffic costs on each platform

A denial of wallet attack doesn't need to take your app down. It only needs to make every request cost you money. Our denial of wallet guide covers how the attack works; this page is about stopping it on the platforms where it hurts most.

  • Cloudflare Workers: the Standard plan includes 10 million requests a month, then $0.30 per additional million, and 30 million CPU milliseconds, then $0.02 per additional million. With Workers Caching on, cached responses are billed at the same per-request rate. See Workers pricing.
  • Vercel: a spend amount does not stop usage on its own. Vercel only pauses production when you turn on Pause Production Deployments, and its spend check runs every few minutes. See Vercel spend management.
  • Twilio: in SMS pumping, fraudsters use a phone number field to trigger messages to numbers they profit from, and they get a share of the revenue. Twilio says these attacks inflate traffic to make money, not to steal data. See SMS pumping and toll fraud.

The brakes Costbrake has against a flood

PlatformBrakeWhat it doesUndo
VercelAttack Challenge ModeEvery visitor must pass a browser challenge; verified bots, webhook providers and your cron jobs still get throughRestores the mode to what it was before
VercelPause projectProduction goes offline with a 503 DEPLOYMENT_PAUSED page and functions stop runningUnpauses the project, if Costbrake paused it
CloudflareCPU capA 50 ms CPU limit on one Worker, so expensive requests fail with error 1102; needs Workers PaidRestores the previous CPU limit, or the 30-second default
CloudflareSpend policy blockBlocks Workers or Durable Objects on the account once this billing period's spend on it reaches $0.01, until the period endsPuts your spend policy back, or turns off the one Costbrake added
CloudflareDetach domainsDetaches a Worker's custom domains and clears its routes, so requests on those hostnames stop reaching itReattaches the saved domains and routes
TwilioBlock high-risk voiceTurns off calling to high-risk special and toll-fraud numbers in every country where it is onTurns it back on for exactly the countries changed
TwilioSuspend subaccountStops one subaccount's calls, messages and API requests; the main account is never touchedSets the subaccount back to active
AWSLambda concurrency to 0AWS throttles every invocation of one function, so nothing runs or billsRestores the previous reserved concurrency

Cloudflare has a few more: turn off a Worker's workers.dev and preview URLs, pause a queue, remove cron triggers, roll back a deployment, or turn off an R2 bucket's r2.dev URL. The spend policy block needs a Cloudflare token with Billing Edit, which you add yourself. The Cloudflare, Vercel, Twilio and AWS pages list every brake, what it does and how to undo it. If the money is leaking through a stolen key rather than traffic, see leaked API key protection.

Native controls to turn on first

  1. On Vercel, Attack Mode is free on all plans, and requests it blocks do not count towards your usage limits. Spend Management costs nothing extra on Pro teams; turn on Pause Production Deployments if you want Vercel to stop at your amount.
  2. On Twilio, disable SMS destination countries you don't use. Twilio recommends this as a line of defense against fraud, and its Verify Fraud Guard protects only the SMS channel.
  3. On Cloudflare, read Cloudflare spending limits for what the account can and can't cap.

Native controls work on fixed numbers and some of them run minutes behind. Costbrake adds the alert when spend moves, on one screen for every platform, and the brake for when the native setting wasn't on.

Who can pull a brake

Only admins and owners. The killswitch is off until an admin turns it on for a connection, a brake asks for the connection's label before it runs, and every request is written to the audit log first. Costbrake never brakes because a rule fired; it alerts, and a person decides.

Brakes are on Pro ($12 a month for 10 accounts) and Team ($39 a month for 50 accounts). Every new workspace starts on a 14-day Pro trial with no card, so the brakes work from the first day. See pricing.

Questions and answers

What is the fastest way to stop a denial of wallet attack on Vercel?

Turn on Attack Mode. It is free on all plans, visitors must pass a security challenge, and Vercel says requests it blocks do not count towards your usage limits. In Costbrake an admin can switch on Attack Challenge Mode from the spike alert. If traffic still costs money, the pause brake takes production offline with a 503 DEPLOYMENT_PAUSED page.

Can Costbrake stop a Cloudflare Workers bill from running away?

It can brake one, with an admin's click. The CPU cap sets a 50 ms limit on a Worker so expensive requests fail with error 1102, the spend policy block stops Workers or Durable Objects on the account once period spend reaches $0.01, and detaching domains stops requests on those hostnames. The alert comes first: on Pro and Team, Cloudflare usage is checked every minute for 2 hours after a spike.

Does Costbrake stop SMS pumping on Twilio?

It alerts on the cost spike and can suspend a Twilio subaccount, which stops its calls, messages and API requests while the main account keeps working. It does not change SMS geo permissions; Twilio recommends disabling SMS destination countries you don't use. It can also turn off calling to high-risk and toll-fraud numbers.

Will Costbrake take my site offline without asking?

No. Alerts go out on their own, but every brake waits for an admin to click it and type the connection's label. Members of the workspace can't use brakes at all.

Is denial of wallet protection on the Free plan?

Free gives spike and budget alerts by email on 2 accounts, with hourly checks, but no brakes. Pro adds 5-minute checks, faster checks during a spike, Slack, Discord and webhook alerts, and the brakes, for $12 a month or $120 a year. New workspaces get 14 days of Pro with no card.

Sources

Updated

Start with 14 days of Pro, free

Catch the next spike before the invoice.

14 days of Pro, then Free for 2 accounts. No card needed.