How a Race Condition in an Order Checkout Led to a $4,000 Triple-
A single-use promotional coupon could be applied multiple times to one order because the server checked coupon validity and marked it used without locking, allowing concurrent requests to all pass the check. An attacker could stack discounts and reduce the order total, potentially to zero.
We often look at security bugs through the lens of broken code syntax or memory leaks. But some of the most expensive vulnerabilities in e-commerce platforms stem from the invisible gap between checks and state changes.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the coupon validation and redemption were not atomic, so concurrent requests could all read the coupon as unused before any of them marked it used.
Impact
The single-use coupon could be stacked multiple times on one order, reducing the total by more than intended; with higher concurrency or a larger voucher, the order total could potentially drop to zero.
What the attacker needed
A test account; a valid single-use coupon code; ability to send concurrent HTTP/2 requests
The fix
The vulnerability was fixed by using atomic database transactions with pessimistic locking, such as a SELECT ... FOR UPDATE statement, to lock the coupon row during validation.
How it was found
- Set up a test account and add an item to the cart.
- Capture the coupon application request in Burp Suite.
- Send the request to Turbo Intruder and configure a script to gate 30 identical requests.
- Launch the script to send all requests simultaneously.
- Observe that three requests returned success and the coupon was applied three times.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A race condition happens when a system checks something and then changes it, but another request sneaks in between those two steps. Here, the server checked if a coupon was unused, then marked it used, but several requests did the check at the same moment, so they all thought the coupon was still valid. This let the attacker use the same coupon several times on one order.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.