Classification
- CWE-362 Race Condition; CWE-367 Time-of-check Time-of-use.
- OWASP Top 10 2021: commonly reported under A04 Insecure Design.
- Related to OWASP API6:2023 when the race abuses a sensitive business flow.
Where races appear
- Limits checked then updated: balances, quotas, stock, votes, likes.
- Single-use tokens: coupons, gift cards, invitations, password reset and email verification links.
- Multi-step state changes: changing an email address while a verification is in flight.
- Rate limits that count requests after processing them.
- File operations: uploading and validating a file in separate steps.
How it is found and proven
Identify an operation that should succeed only once or up to a limit. Prepare many identical requests and release them together, ideally with a single-packet technique over HTTP/2 or last-byte synchronisation over HTTP/1.1, so they arrive within a millisecond window. Proof is an outcome that should be impossible: a coupon applied five times, a balance below zero, two accounts created with one invitation. Repeat the test to show it is reproducible, and use test accounts and amounts.
Remediation
Make check-and-update atomic. Use database constraints (unique keys, check constraints), conditional updates (UPDATE ... WHERE balance >= amount), row-level locks or serialisable transactions. Mark single-use tokens consumed in the same atomic operation that validates them. Use idempotency keys for payment-like operations. Avoid splitting validation and use of the same resource across requests.
What Pentest-Swarm covers for race conditions
Pentest-Swarm does not currently test race conditions automatically. Its timing oracle measures injected delays for blind injection; it does not orchestrate synchronised parallel requests against business operations.
- It does prove the authorisation classes (BOLA, BFLA, mass assignment) on the same endpoints a race would target.
- Its concurrent swarm scheduler (alpha) runs agents in parallel, but that is about test throughput, not race-condition exploitation.
- Reports state what was tested so race-condition coverage can be planned separately.
Where it falls short
Use Burp Suite's Repeater group sending or the Turbo Intruder extension, which support single-packet attacks, and a tester who has identified which operations are limit-bound. Code review is often more efficient: look for read-then-write patterns without transactions or constraints around money, quotas and tokens.
Questions
What is a single-packet attack?
A technique that sends many HTTP/2 requests so their final bytes arrive in one TCP packet, removing network jitter so the server processes them almost simultaneously.
Do rate limits prevent race conditions?
Not reliably. A burst of parallel requests can arrive before the limiter counts them, and the race itself may need only a handful of requests.
Are race conditions only in payments?
No. Any one-time or limited action, such as invitations, votes, verification links or quotas, can be affected.