Skip to content
Race condition Write-up Beginner

Race Condition — Resulted in using the feature which was supposed to be obtained after subscription.

A web application allowed only one user to be added to an account without a subscription, but by sending two invite requests simultaneously from different browsers, two members were added, bypassing the subscription requirement.

medium.com

Published on medium.com

Race Condition

BabaBounty, 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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

The target was a private bug bounty program, so the author refers to it only as Example.com. The feature in question is user invitation: an account owner can invite other users into their account. The product places a limit on this. Without a subscription plan, only one member can be added. To add more than one user, the owner has to buy the subscription plan.

The vulnerability class is a race condition. As the author describes it, computing systems must execute some tasks in a specific sequence, and in any such sequence there is a small window between the system carrying out the first task and starting the second. If that window is long enough, or the attacker is lucky and knowledgeable, the system can be tricked into carrying out unauthorised actions alongside its normal processing.

Setup

The author does not describe any special tooling. The only precondition was an owner account on Example.com that had not bought the subscription plan, plus the ability to open that same owner account in more than one browser. Two browsers were used: Firefox and Chrome. No versions, endpoints, parameters or headers are given in the report.

Finding it

The author first invited a single member and observed the behaviour of the interface. Only one member was allowed to be added without a subscription, and the "add user button" became disabled after that one member had been invited.

Exploitation

Step 1: Open the same owner account in a second browser

The author opened the same owner account in another browser, so that the same account was active in two places at once. This gives two independent sessions that can each act on the account.

Step 2: Invite a different member from each browser

In Firefox and in Chrome, the author added two different members, one per browser, and triggered the requests simultaneously. The report does not include the raw invitation request, so the endpoint, method, parameters and any anti-CSRF tokens are not shown.

Step 3: Observe the result

Both invitations succeeded. Two members were added to the account, and the limit of one member without a subscription was bypassed. The author summarises the outcome as the limit being bypassed without the subscription.

Root cause

The report does not examine the server-side code, so the exact mistake is not shown. What the behaviour implies is that the check on how many members the account already has and the action of adding a new member are not performed atomically. When two invitation requests arrive at nearly the same moment, each one can read the account state before the other has written its new member, so both pass the limit check. This is an inference from the observed behaviour rather than something the report confirms.

Impact

An account owner without a subscription could add more members than the plan allows, obtaining a feature that was supposed to require a paid subscription. The author frames the impact in exactly those terms: using a feature that was supposed to be obtained only after subscribing. The attack requires the ability to send two invitation requests at effectively the same time, which the author achieved with two browsers on the same owner account. The report does not discuss any other consequence, such as what the extra members could then do inside the account.

Fix

The author's mitigation advice is general rather than a description of a change made to the target. Preventing a race condition means synchronising or strictly controlling the order of operations in the functions and actions that may be vulnerable, and the recommended way to do that is with locks. Most programming languages provide built-in locking for data: the author cites Python's threading.Lock and Go's sync.Mutex as examples. The author also recommends locking the relevant parts of a file to different processes rather than locking the file as a whole.

Variants to test

  1. Invitation and seat limits. Send two invitations for different users at the same moment from two sessions of the same owner account. A positive result is both invitations being accepted while the account is still on the plan that permits only one.
  2. Any action gated by a count. Look for features where a numeric limit is checked before a write, such as member caps, project caps or saved-item caps, and fire the write requests in parallel. A positive result is the stored count exceeding the plan limit.
  3. Client-side-only controls. Where a button is disabled after an action, replay the underlying request from a second session. A positive result is the server accepting the action the interface refused to send.
  4. Subscription-gated features. For any feature that unlocks after purchase, try triggering it concurrently from a non-subscribed account. A positive result is the feature working without the subscription.

The author notes that this submission was marked as a duplicate, while still considering the finding creative and knowledgeable.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 7 min read.

What happened, in plain words

A security researcher found a way to get a paid feature for free on a private bug bounty program. The program is referred to only as Example.com. The feature lets an account owner invite other people into their account. Without a subscription, only one member can be added; to add more, the owner must buy a subscription plan. The researcher discovered that by opening the same owner account in two different browsers (Firefox and Chrome) and sending two invitations at almost the same moment, both invitations were accepted. The account ended up with two members even though no subscription was purchased. This is a race condition: two nearly simultaneous requests were both accepted, bypassing the one-member limit. The report was marked as a duplicate, but the researcher still considered the approach creative and knowledgeable.

Understanding the basics

Before diving into the steps, let's clarify some terms that appear in this report.

  • Bug bounty program: A program run by a company that rewards security researchers for finding and reporting vulnerabilities in their systems. A private program is invitation-only, so the company's name is often kept secret.
  • Race condition: A situation where a system performs two or more operations in a sequence, and a tiny gap between them allows an attacker to interfere. Imagine two people trying to withdraw the last $100 from an ATM at the same time: both check the balance, see $100, and both withdraw $100, leaving the account overdrawn. The check and the withdrawal are not atomic (they don't happen as a single indivisible step).
  • Subscription plan: A paid tier that unlocks additional features. Here, without a subscription, only one member can be added to an account.
  • Invitation feature: The ability for an account owner to invite other users to join their account. The interface has an "add user button" that became disabled after one member was invited.
  • Client-side vs server-side: The browser (client) enforces some rules, like disabling a button. The server is the computer that actually processes requests and stores data. A common mistake is to rely only on client-side checks; an attacker can bypass them by sending requests directly.
  • Session: A period of interaction between a user and a system. When you log in, the server gives your browser a session identifier (often stored in a cookie) so it can recognise you on subsequent requests. Opening the same account in two browsers creates two independent sessions.
  • Simultaneous requests: Sending two HTTP requests at almost the same time, so that the server processes them concurrently rather than one after the other.

The target and the feature

The target was a private bug bounty program, so the author refers to it only as Example.com. The feature in question is user invitation: an account owner can invite other users into their account. The product places a limit on this. Without a subscription plan, only one member can be added. To add more than one user, the owner has to buy the subscription plan.

The vulnerability class is a race condition. As the author describes it, computing systems must execute some tasks in a specific sequence, and in any such sequence there is a small window between the system carrying out the first task and starting the second. If that window is long enough, or the attacker is lucky and knowledgeable, the system can be tricked into carrying out unauthorised actions alongside its normal processing.

Setup

The author does not describe any special tooling. The only precondition was an owner account on Example.com that had not bought the subscription plan, plus the ability to open that same owner account in more than one browser. Two browsers were used: Firefox and Chrome. No versions, endpoints, parameters or headers are given in the report.

Finding it

The author first invited a single member and observed the behaviour of the interface. Only one member was allowed to be added without a subscription, and the "add user button" became disabled after that one member had been invited.

Exploitation

Step 1: Open the same owner account in a second browser

The author opened the same owner account in another browser, so that the same account was active in two places at once. This gives two independent sessions that can each act on the account.

Step 2: Invite a different member from each browser

In Firefox and in Chrome, the author added two different members, one per browser, and triggered the requests simultaneously. The report does not include the raw invitation request, so the endpoint, method, parameters and any anti-CSRF tokens are not shown.

Step 3: Observe the result

Both invitations succeeded. Two members were added to the account, and the limit of one member without a subscription was bypassed. The author summarises the outcome as the limit being bypassed without the subscription.

Root cause

The report does not examine the server-side code, so the exact mistake is not shown. What the behaviour implies is that the check on how many members the account already has and the action of adding a new member are not performed atomically. When two invitation requests arrive at nearly the same moment, each one can read the account state before the other has written its new member, so both pass the limit check. This is an inference from the observed behaviour rather than something the report confirms.

Impact

An account owner without a subscription could add more members than the plan allows, obtaining a feature that was supposed to require a paid subscription. The author frames the impact in exactly those terms: using a feature that was supposed to be obtained only after subscribing. The attack requires the ability to send two invitation requests at effectively the same time, which the author achieved with two browsers on the same owner account. The report does not discuss any other consequence, such as what the extra members could then do inside the account.

Fix

The author's mitigation advice is general rather than a description of a change made to the target. Preventing a race condition means synchronising or strictly controlling the order of operations in the functions and actions that may be vulnerable, and the recommended way to do that is with locks. Most programming languages provide built-in locking for data: the author cites Python's threading.Lock and Go's sync.Mutex as examples. The author also recommends locking the relevant parts of a file to different processes rather than locking the file as a whole.

Variants to test

  1. Invitation and seat limits. Send two invitations for different users at the same moment from two sessions of the same owner account. A positive result is both invitations being accepted while the account is still on the plan that permits only one.
  2. Any action gated by a count. Look for features where a numeric limit is checked before a write, such as member caps, project caps or saved-item caps, and fire the write requests in parallel. A positive result is the stored count exceeding the plan limit.
  3. Client-side-only controls. Where a button is disabled after an action, replay the underlying request from a second session. A positive result is the server accepting the action the interface refused to send.
  4. Subscription-gated features. For any feature that unlocks after purchase, try triggering it concurrently from a non-subscribed account. A positive result is the feature working without the subscription.

The author notes that this submission was marked as a duplicate, while still considering the finding creative and knowledgeable.

Glossary

  • Bug bounty program: A program where companies reward researchers for finding security vulnerabilities.
  • Private program: A bug bounty program that is invitation-only and not publicly listed.
  • Race condition: A vulnerability where the timing of actions allows an attacker to bypass limits or cause unintended behaviour.
  • Subscription plan: A paid tier that unlocks additional features or limits.
  • Invitation feature: The ability to invite other users to join an account.
  • Client-side: Actions or checks performed in the user's browser.
  • Server-side: Actions or checks performed on the server that hosts the application.
  • Session: A period of interaction identified by a session token, allowing the server to recognise a user across requests.
  • Simultaneous requests: Sending multiple requests at nearly the same time.
  • Atomic operation: An operation that completes entirely or not at all, with no intermediate state visible to other operations.
  • Lock: A mechanism to ensure that only one process or thread can access a resource at a time.
  • CSRF token: A secret value included in requests to prevent cross-site request forgery attacks.

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.