Race Conditions - PortSwigger
In this article, we will cover the topic of Race Conditions, including both the theory and practical lab exercises. The original theory and lab material can be found on the PortSwigger - Race Conditions
Date: 4 September 2026
Table of Contents
Section titled “Table of Contents”- Limit Overrun Race Conditions
- Detecting and Exploiting Limit Overrun Race Conditions with Turbo Intruder
- Hidden Multi-Step Sequences
- Methodology
- Multi-Endpoint Race Condition
- Deal with Delay
- Single Endpoint Race Condition
- Session-Based Locking Mechanisms
- Partial Construction Race Conditions
- Time-Sensitive Attacks
Race condiiton is a type of vulnerability that occurs when two concurrent request are processed by the application at the same causing collision which result in unintended behaviour of the application which can be exploited by the attacker.
Time window in which the race condition occurs is called race window.
Limit Overrun Race Conditions
Section titled “Limit Overrun Race Conditions”Problem : We can use a single discount code more than once.
Instead of sending a single request we send two request concurrently so a race window occurs and discount applies two times.
Limit Overrun are subtype of so called “time-of-check to time-of-use” flaws
Time of check -> Whether the code is used or not Time of use -> using the code
Gap between both can cause a race window
Lab 1 - Limit overrun race conditions
Detecting and exploiting limit overrun race conditions with Turbo Intruder
Section titled “Detecting and exploiting limit overrun race conditions with Turbo Intruder”Turbo Intruder is a Burpsuite extension that can be used for the purpose of exploiting one packet race condition flaw.
There are some script that are already available to exploit different types of flaw which includes this flaw too.
Lab 2 - Bypassing rate limits via race conditions
Hidden multi-step sequences
Section titled “Hidden multi-step sequences”There are some request in the web application that can seens to be single step but in background they are multi step known as sub state.
In this case we can send two parallel request to the application bypassing some mid sub states.
Example of sub-states:
POST /forgot-password │ ▼┌─────────────────────┐│ Find user │└──────────┬──────────┘ ▼┌─────────────────────┐│ Generate token │└──────────┬──────────┘ ▼┌─────────────────────┐│ Save token │└──────────┬──────────┘ ▼┌─────────────────────┐│ Send email │└─────────────────────┘Methodology
Section titled “Methodology”There is a three step methodology for hidden multi step sequence :
- Predict : Identify security-critical endpoints and determine whether multiple requests could interact with the same underlying state or record.
- Probe : Establish the endpoint’s normal behavior, then send potentially colliding requests in parallel and look for unexpected differences in responses or application behavior.
- Prove : Reduce the requests to the minimum required set, reproduce the behavior consistently, and demonstrate the security impact.
Example :
Suppose we have a login like -
/Login -> MFA -> Login Sucessfull
In code :
session['userid'] = user.userid
if user.mfa_enabled: session['enforce_mfa'] = Truewe have a endpoint /admin so if we try to do -
/login -> MFA -> logged in -> /admin -> it will fail.
but we can see there is a race window between login and MFA so what if we send request in parallel to login and /admin
/login --- | -> GET /admin (user id: victim) MFA not enforced/admin ---Multi Endpoint Race Condition
Section titled “Multi Endpoint Race Condition”Instead of race conditioning the same endpoint we can send parallel request to different endpoints.
We can understand with an example of shopping application.
Suppose there are two request :
POST /makePaymentPOST /addToCartThe normal Workflow is -
/addToCart ↓Basket = pending ↓/makePayment ↓Payment validated ↓Basket = confirmed/makePayment might internally take some time which can open a race window allowing us to send request to another endpoint in that window.
/makePayment │ ▼ Payment validated │ │ │ ← RACE WINDOW │ ├──────────────┐ │ │ │ /addToCart │ │ │ ▼ │ Add expensive item │ ▼ Basket confirmedBut there might be delay in the request execution that can make our attack fail.
Types of Delay :
- Network Latency : Time required to travel through the network.
- Network Jitter : Req 1 > 80ms , req2 > 85ms (variation in delay)
- Internal Endpoint latency : In how much time the serevr processed the request /addtocart > 20ms , /makePayment > 500ms
Deal with Delay
Section titled “Deal with Delay”- To deal with this delay we can do
Connection Warming
Instead of sending the actual request we can send the dummy request to test the delay first or to avoid the delay in our race request. we can simply understand it as the server need to setup the connection in the initial request so if send our race condition request in that step it will make our attack fail because of latency so to avoid this delay we use a simple reuqest to anything endpoint like homepage.
- Make the server slow or increase resources usage
By sending the dummy request using turbo intruder.
Lab 3 - Multi-endpoint race conditions
Single Endpoint Race Condition
Section titled “Single Endpoint Race Condition”To better understand this kind of race conditon we can take an example of an application’s password reset functionality.
Endpoints : /reset-user and /reset-token
Suppose we sent request for our case -
request 1 |/reset-user = hacker --> Race Window -> Request 2 | /reset-user = victim /reset-token = 989/reset-token = 123In the final state of the application the reset token will be 123 and reset user will be vicitm.
Lab 4 - Single-endpoint race conditions
Session-based locking mechanisms
Section titled “Session-based locking mechanisms”In some application there is a mechanism installed that locks the request processing based on session.
so race condition will work only when we send requests in two different session other wise it will lock send the request one by one instead of parallel.
Partial construction race conditions
Section titled “Partial construction race conditions”In this kind of race conditon some partial construction of some entity takes place that causes the race window to open and can be exploited by the attacker.
Example :
Request to create an user | User : Victim | -> Race Condition: In this window the API key for | the user victim is NIL so | we can access thier account using the API key null. API Key : NILWe can do this with password instead of API key but the passwords are hashed so we need to know the hashed version of null.
Lab 5 - Partial construction race conditions
Time-sensitive attacks
Section titled “Time-sensitive attacks”In this kind of attack some special logic in the application is required to create a situation similar to race condition to exploit the behaviour.
For example : Application using timestamp instead of cryptographic hash to generate the token for password reset in this case what is possible is we can send two request in parallel so that both the request gets same time stamp.