Skip to content
Race condition Write-up Beginner

Bug Bounty Race: Exploiting Race Conditions for Infinite Discount

The application did not lock coupon usage during the apply-coupon process, so sending many identical requests at the same time applied the same discount repeatedly. An attacker could buy an item for far less than the intended price.

Aditya Bhatt Follow

Published on infosecwriteups.com

A Race Condition occurs when two or more operations are executed concurrently, and the final outcome depends on the timing or order of execution. If these operations are not synchronized properly, it can lead to unexpected or malicious results.

Aditya Bhatt, on infosecwriteups.com

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 server did not use locking or atomic operations when applying a coupon, so concurrent requests all passed the check before any of them updated the cart.

Impact

An attacker could apply the same coupon many times and buy goods for less than the intended price, causing financial loss to the shop.

What the attacker needed

A user account; a valid coupon code; ability to send parallel requests

The fix

The endpoint should be fixed by using database-level locking or atomic operations and idempotency checks so a coupon can only be applied once.

How it was found

  1. Log in and add the target jacket to the cart.
  2. Apply the coupon and intercept the coupon application request.
  3. Send the request to Repeater and duplicate it many times.
  4. Put all copies in one tab group and send them in parallel.
  5. Observe multiple success messages and a much lower cart total.
  6. Purchase the jacket with the reduced price.

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 program checks something and then acts on it, but another request slips in between the check and the action. Here, the shop checked the coupon and then applied it, but many requests arrived at once before the first one finished, so the discount was added many times. This let someone buy an expensive item very cheaply.

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.

More by Aditya Bhatt

View all

25 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.