Limit-Overrun Race Conditions

Performing an action more times than the application allows by firing concurrent requests at a non-atomic read-check-decrement on a single-use or capped resource.

How it works

A one-time or capped resource — gift card, coupon, wallet balance, OTP-attempt budget, limited-stock item, referral bonus — is guarded by logic shaped like:

if resource.is_available():   # time-of-check: reads "unused"
    apply(resource)           # time-of-use: marks "used", credits value

The read and the decrement aren’t atomic. Two backend threads — one verifying status, one marking it used — run concurrently. Fire N requests so they all reach the check before any completes the mark, and all N see “available.” The counter overruns: a single-use gift card applies many times, 50 withdrawals of $1,000 against a $1,000 balance net $50,000, one coupon discounts an order repeatedly.

The attacker’s whole job is landing enough requests inside the window. Sequential tools (Repeater, classic Intruder) are too slow and too spaced; you need a synchronised batch (gates, or the Single-Packet Attack for sub-ms delivery).

Where to find it

  • Payments / value: gift-card and voucher redemption, coupon/discount application, loyalty and referral credits, wallet top-up and withdrawal, refund issuance (refund race).
  • Rate / attempt budgets: OTP and password-reset code attempts — concurrency lands far more guesses than the “5 tries” limit, enabling brute force of short tokens (API Rate Limiting, MFA Bypass). RyotaK’s first-sequence sync pushed a 5-attempt limit to ~1,000.
  • Stock / quotas: limited-edition purchases, seat/inventory holds, free-tier quotas, invite caps.
  • APIs and GraphQL: a financial or coupon endpoint hit with ~100 parallel requests; GraphQL aliasing packs many mutations into one operation as a built-in amplifier (GraphQL Batching Attacks).

How to test

  1. Identify a single-use or capped action with an observable effect (balance delta, “redeemed” flag, discount applied).
  2. Baseline sequentially: confirm the second attempt is normally rejected.
  3. Queue the request many times through a Turbo Intruder gate (gate='race1', then openGate) or Nuclei race: true / race_count; for HTTP/2+ use the single-packet attack.
  4. Count successes. More than one “redeemed”/credit = overrun.
  5. Need thousands of attempts (e.g. short OTP)? Scale with first-sequence sync.
# Turbo Intruder, limit-overrun skeleton
def queueRequests(target, wordlists):
    engine = RequestEngine(endpoint=target.endpoint, concurrentConnections=20)
    for i in range(50):
        engine.queue(target.req, gate='race1')
    engine.openGate('race1')

Notable cases

  • $10,000 HTTP/2 window race on a financial SaaS — single-packet state-window bypass (writeup).
  • Paywall / coupon reuse — single-use discount codes applied multiple times before the system marks them used (Intigriti tip 21).
  • Gift-card and currency-transaction overruns — canonical “free money glitch” scenarios (NahamSec, Backend Mastery).
  • Coupon endpoint, parallel redemption — standard API-pentest finding via Turbo Intruder (API pentest guide).

Defenses

  • Atomic decrement: UPDATE accounts SET balance = balance - :amt WHERE id = :id AND balance >= :amt and check affected rows; a conditional single-statement update, not read-then-write.
  • Unique constraint on the one-time resource (e.g. (coupon_id, order_id)) so a duplicate redemption fails at the DB.
  • Row-level locking (SELECT ... FOR UPDATE) or optimistic version/CAS columns around the check-and-act.
  • Idempotency keys so repeated/parallel submissions collapse to one effect.
  • Attempt budgets enforced by an atomic counter, not a read-modify-write, so single-packet bursts can’t overrun them.

See also: Coupon and Reward Abuse

Sources