Skip to content
Race condition Write-up Intermediate

Ehxb Race Conditions Vulnerabilities I

The application allowed a single-use discount code to be applied multiple times because the check for prior use and the update marking it used were not atomic. An attacker could send many requests in parallel to overrun the limit and obtain a larger discount than intended.

ehxb Follow

Published on infosecwriteups.com

After diving deep into file upload vulnerabilitiespart 1 andpart 2, I thought I had a good grasp on web application security. But then I stumbled upon a different beast: Race Conditions.

Ehxb, 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 check for whether the coupon was already applied and the update marking it as used were not performed atomically, leaving a race window.

Impact

An attacker could apply a single-use discount code multiple times, obtaining a significantly cheaper order and causing financial loss to the business.

What the attacker needed

A user account; a valid single-use discount code; ability to send parallel HTTP/2 requests

How it was found

  1. Log in and buy the cheapest item using the discount code to study the purchasing flow.
  2. Identify the POST /cart/coupon request that applies the discount code.
  3. Clear any applied discount codes from the cart.
  4. Send the POST /cart/coupon request to Repeater and duplicate it 19 times in a group.
  5. Send the group in sequence to confirm only the first succeeds (baseline).
  6. Remove the discount code again and send the same group in parallel to trigger the race condition.

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 website checks something (like 'has this discount code been used?') and then acts on it, but another request can sneak in between the check and the action. Here, sending many requests at almost the same moment let the discount be applied several times before the site recorded that it was used.

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 ehxb

View all

1 more disclosed report, 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.