# 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.
```python
# 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 ([[raw/medium.com/how-i-turned-a-single-packet-mismatch-into-a-10-000-single-packet-race-14400|writeup]]).
- **Paywall / coupon reuse** — single-use discount codes applied multiple times before the system marks them used ([[raw/intigriti.com/31-bite-sized-tips-and-bug-bounty-resources-for-2026-3611|Intigriti tip 21]]).
- **Gift-card and currency-transaction overruns** — canonical "free money glitch" scenarios ([[raw/nahamsec.com/top-vulnerabilities-for-pentest-bug-bounty-in-2025-4269|NahamSec]], [[raw/medium.com/backend-mastery-the-real-bug-bounty-superpower-2026-3601|Backend Mastery]]).
- **Coupon endpoint, parallel redemption** — standard API-pentest finding via Turbo Intruder ([[raw/nflo.tech/api-penetration-testing-complete-guide-4321|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.
## Related
- [[Race Conditions]] — parent guide.
- [[Single-Packet Attack]] — the delivery primitive; first-sequence sync for thousands of attempts.
- [[Multi-Endpoint Races]] — the other main web-race family (state-change / TOCTOU).
- [[API Rate Limiting]], [[MFA Bypass]], [[GraphQL Batching Attacks]], [[Turbo Intruder]].
See also: [[Coupon and Reward Abuse]]
## Sources
- [[raw/medium.com/how-i-turned-a-single-packet-mismatch-into-a-10-000-single-packet-race-14400|How I Turned a Single Packet Mismatch into a $10,000 Single-Packet Race Condition]]
- [[raw/intigriti.com/31-bite-sized-tips-and-bug-bounty-resources-for-2026-3611|31 Bite-Sized Tips and Bug Bounty Resources for 2026]]
- [[raw/nahamsec.com/top-vulnerabilities-for-pentest-bug-bounty-in-2025-4269|Top Vulnerabilities for Pentest & Bug Bounty in 2025]]
- [[raw/nflo.tech/api-penetration-testing-complete-guide-4321|API Penetration Testing: Complete Guide]]
- [[raw/medium.com/backend-mastery-the-real-bug-bounty-superpower-2026-3601|Backend Mastery: The Real Bug Bounty Superpower (2026)]]
- [[raw/tib3rius.com/web-appsec-interview-questions-5906|Web AppSec Interview Questions]]
- [[raw/redfoxsec.com/common-bug-bounty-vulnerabilities-a-technical-deep-dive-for-hunters-in-4902|Common Bug Bounty Vulnerabilities: A Technical Deep Dive]]