Race Condition Rumble: How I Bought 100 Products for the Price o
The checkout API lacked concurrency control, so sending many simultaneous order requests resulted in multiple confirmed orders while the payment was charged only once. An attacker could obtain many products for the price of one.
Free Link 🎈
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 order and payment endpoints had no locking or atomic check, so concurrent requests each created a confirmed order before the payment state was updated.
Impact
An attacker could obtain unlimited products for the price of one, causing financial loss to the platform, especially during sales.
What the attacker needed
Access to the checkout API; a valid authorisation token; ability to send concurrent requests
The fix
The order and payment processing should use locking, atomic operations, or a server-side flag to lock stock and payment status before processing.
How it was found
- Find the checkout and payment API endpoints on a staging environment.
- Send many simultaneous order requests for the same product using multiple threads.
- Observe that many orders are confirmed but only one payment is charged.
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 handles several requests at the same time and does not check properly whether an action has already been done. Here, many order requests were processed together, and the payment step only ran once, so the attacker got many orders for one payment.
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.