Skip to content
Race condition Write-up Intermediate

The “Infinite Discount” Glitch: How I Used a Race Condition t

A race condition in a coupon redemption system allowed multiple simultaneous requests to apply the same discount code, because the server checked coupon usage without locking the database row. An attacker could repeatedly apply the coupon to drive the cart total negative, effectively making the store owe them money.

T4nv1 Follow

Published on medium.com

This is the story of how a “boring” e-commerce site turned into a playground for a Race Condition vulnerability. If you think hacking is all about sophisticated code injection, you’re missing the easiest way to make a platform cry: doing everything at once.

T4nv1, on medium.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 performed a check-then-act on the coupon usage without locking the database row, so concurrent requests could all pass the check before any write occurred.

Impact

An attacker could obtain products for free or even receive money, as the cart total could become negative, though the attacker did not complete the purchase to avoid fraud.

What the attacker needed

A user account on the e-commerce site; a valid coupon code; ability to send many simultaneous requests

How it was found

  1. Add an expensive item to the cart.
  2. Use a tool to send many 'Apply Coupon' requests simultaneously.
  3. Observe that the coupon is applied multiple times, reducing the total price.
  4. Increase the number of simultaneous requests to push the total below zero.

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 computer checks something and then updates it, but another request sneaks in between those two steps. Here, the server checked if a coupon was already used, but before it could mark it as used, other requests also saw it as unused and applied the discount again. By sending many requests at the same instant, the attacker got the discount many times.

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 T4nv1

View all

113 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.