Multi-endpoint race and file downloads via race
A state race between different handlers working with shared data. A CTF scenario: one endpoint adds an item to the cart, another initiates payment. If the payment request is sent simultaneously with the cart update, the server may process the payment at the old price with the new contents. A multi-threaded attack on a web application with a multi-endpoint race is complicated by the fact that different endpoints process at different speeds, requiring additional synchronization techniques (connection warming, request padding).
A separate and extremely practical CTF scenario involves uploading files through a race window. The server accepts the file, saves it to a temporary directory, checks the contents against a whitelist of extensions, and deletes it if the check fails. Between saving and deleting, there's a race window. The attacker uploads a web shell through POST /uploadand simultaneously sends multiple GET requests to the upload path—if at least one GET request hits the window before it's deleted, the shell is executed. PortSwigger Academy has a dedicated lab dedicated to this: "Web shell upload via race condition."
CVSS 8.1 (HIGH), vector CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H, CWE-362. According to NVD, an unauthenticated attacker could execute arbitrary code via a race condition in a temporary directory when the developer allowed the user to specify a file name in the method fromDataThere are no public proof-of-concept exploits in open databases (Exploit-DB); the scenario below is an illustration of the general file-upload race technique, not an exact reproduction of the exploitation of this CVE. According to CISA (SSVC Decision: Track), exploitation is not automated, but the technical impact is total—by hitting the race window, the attacker gains complete control. Marker AC:H(Attack Complexity: High) in the CVSS vector is a characteristic sign of a race condition: exploitation depends on precise timing.
Burp Suite Turbo Intruder: A Guide to Exploiting Race Conditions
Turbo Intruder is a Burp Suite extension with a Jython engine by James Kettle. It's available through the BApp Store. The key concept for race conditions is a gate: requests are queued with a flag and aren't dispatched until called. openGate()When all requests are in the queue, the gate drops them all at once, in one packet.
Scenario 1: Limit Overrun. Intercept the Request POST /apply-couponVia Burp Proxy, right-click → Extensions → Turbo Intruder → Send to Turbo Intruder. In the bottom panel, replace the script:
def queueRequests(target, wordlists):
engine = RequestEngine(endpoint=target.endpoint,
concurrentConnections=1,
engine=Engine.BURP2)
for i in range(20):
engine.queue(target.req, gate='race1')
engine.openGate('race1')
engine.complete(timeout=60)
def handleResponse(req, interesting):
table.add(req)
Parsing parameters. engine=Engine.BURP2Enables HTTP/2 single-packet mode—all 20 requests are sent in a single TCP packet. But there's a catch: this only works if the connection to the target is actually over HTTP/2 (ALPN h2). Check the protocol in the "Protocol" column in Burp's HTTP History—if it's HTTP/1.1, Turbo Intruder will either throw an error or silently fall back to HTTP/1.1 semantics without the single-packet attack. concurrentConnections=1- one TCP connection, all requests via multiplexing. gate='race1'— requests accumulate and are not sent to the server until called openGate('race1'). Sample race-single-packet-attack.pyis located in the standard Turbo Intruder examples directory.
And now the most common place where everything breaks down. If the server only supports HTTP/1.1, replace Engine.BURP2on Engine.THREADEDand increase concurrentConnectionsto 10-30. When BURP2On an HTTP/1.1 server, requests will be sent sequentially—I see this all the time during CTFs. A player copies a script from writeup, runs it, gets 20 consecutive "coupon already used" messages, and thinks there's no race condition. The problem is in the engine.
Scenario 2: Uploading a file through a race window. The server deletes the uploaded file milliseconds after verification. Simultaneously send a POST from the web shell and several GET requests to the upload path:
def queueRequests(target, wordlists):
engine = RequestEngine(endpoint=target.endpoint,
concurrentConnections=10)
# request1 и request2 — скопируйте raw-запросы из Burp HTTP History целиком,
# сохранив точный Content-Length и multipart boundary, иначе сервер вернёт 400.
request1 = '''POST /upload HTTP/1.1\r\nHost: target...'''
request2 = '''GET /files/shell.php HTTP/1.1\r\nHost: target...'''
engine.queue(request1, gate='race1')
for x in range(5):
engine.queue(request2, gate='race1')
engine.openGate('race1')
engine.complete(timeout=60)
def handleResponse(req, interesting):
table.add(req)
IN request1insert the full POST request with the multipart body (copy from Burp HTTP History), in request2— GET to the path where the file is being uploaded. Of the six requests (one POST + five GETs), it's enough for at least one GET to hit the window between saving the file and deleting it. According to PortSwigger lab data, with five GET requests, two or three of them are hit.
Scenario 3: Multi-endpoint race. To alternate requests to different endpoints, modify the request body before engine.queue(), substituting the desired path or parameters. To fine-tune the timing between groups, use time.sleep()in Jython - useful when you need to adjust the order of processing on the server.
Parallel Queries in Burp Repeater for Faster Reconnaissance
You don't need to write a Jython script to test a race condition hypothesis. Modern versions of Burp Suite (since 2023) have native parallel sending in Repeater. Intercept the target request, send it to Repeater, duplicate the tab 10-20 times using Ctrl+R, create a tab group, and select "Send group in parallel." Burp automatically applies a single-packet attack for HTTP/2 or last-byte sync for HTTP/1.
This method is simpler than Turbo Intruder, but less flexible: you can't vary the payload between requests, it's harder to scale beyond 30 requests, and you can't alternate requests to different endpoints. For initial reconnaissance, the limit overrun is more than sufficient.
A practical nuance: the first request in a group is sometimes slower due to a cold connection to the backend. According to PortSwigger, an empty GET to the root path at the beginning of a tab group (connection warming) removes this noise and evens out timing within the group.
Race Condition Debugging: When an Exploit Fails
A race condition that didn't work the first time doesn't mean it doesn't exist. I run this checklist on every CTF task before discarding a hypothesis.
Check the engine. If the server is on HTTP/1.1, and the script says Engine.BURP2— requests will not be packaged into a single packet. Define the protocol via curl -vvvor by response headers. HTTP/2 — Engine.BURP2 + concurrentConnections=1. HTTP/1.1 — Engine.THREADED + concurrentConnections=10-30. Also available for HTTP/1.1 Engine.BURP, which uses last-byte sync via the native Burp engine.
Bypass session locking. PHP serializes all requests with one by default. session_idBy locking the session file. Twenty parallel requests from a single cookie are processed strictly sequentially—no race window. According to HackTricks, the solution is to use a different session token for each request, if logic allows. Other frameworks with session-based locking (some Java Servlet implementations, Django with database-backed sessions) behave similarly. At CTFs, you can usually log in to multiple sessions simultaneously—just open an incognito window and get a second session_id.
Warm up the connection. The first request in a series is often slower: the server establishes a connection to the database, initializes the thread pool, and warms up the cache. Add a "dummy" GET request to the root path before the main group. In Turbo Intruder, one engine.queue()without gate before loop with gate.
Repeat 5-10 times. Server jitter (GC pauses, thread pool locks, cache misses) can delay processing unpredictably. Three unsuccessful attempts are not a death sentence. For CTFs, 3-5 attempts are usually enough to confirm, but for complex race conditions with a narrow window, up to 10 attempts are recommended.
Analyze response timing. A sign of a race window in Turbo Intruder is a negative timestamp in the response time column. This means the server began responding before the request was fully sent—requests were processed in parallel and overlapped. Another indicator is identical success responses to requests where one should have received a "coupon already used" or "insufficient balance" error.
Increase the number of requests. If 20 requests don't fit within the race window, try 30. For HTTP/2 single-packet attacks, the limit is the TCP packet size (~1500 bytes). If the requests are long (heavy cookies, large headers), less will fit into a single packet. Reduce headers to a minimum or split them into multiple waves.
Methodology: How to exploit race conditions step by step
According to PortSwigger Research, the race condition exploitation methodology is built on three stages: predict, probe, prove.
Predict — predict collisions. Look for endpoints where two or more requests access the same data. Markers in CTF tasks: operations with balance, coupons, attempt limits, order status, user email, and file uploads. Pay special attention to hidden multi-step sequences: a single HTTP request triggers a chain of actions with intermediate states on the server. Changing email, generating an OTP, and registering a user are all multi-step processes, where each step creates a sub-state that can be intercepted.
Practical tip: examine all endpoints that access a single resource (one database table, one file, one session). If two endpoints read and write to the same resource, this is a potential multi-endpoint race.
Probe. Send a group of 20-30 parallel requests and analyze the responses. Look for anomalies: multiple success responses where you expected one success and 19 errors; altered numerical values (balance, quantity); responses with different content for identical requests. At this stage, you don't need a ready-made exploit—you just need confirmation that the race window exists.
Prove it. Reduce the number of requests to a minimum, reproduce the anomaly reliably. For CTFs, claim the flag. For bug bounty, document it with a reproducible Turbo Intruder script.
Preconditions and constraints for each type of race condition:
| Type | Protocol | Minimum requests | Characteristic complexity |
|---|---|---|---|
| Limit overrun | HTTP/2 или HTTP/1.1 | 10-20 | Low: one endpoint, one payload |
| Single-endpoint collision | HTTP/2 is preferred | 2-5 (different payloads) | Medium: Need to understand sub-states |
| Multi-endpoint race | HTTP/1.1 или HTTP/2 | 2-10 to different paths | High: Synchronization between endpoints |
| File upload race | HTTP/1.1 (more common) | 1 POST + 5 GET | Medium: Needs an exact download path |
Race conditions outside of CTF: real CVEs
Race conditions are not a training vulnerability. Two confirmed CVEs from NVD demonstrate the range of consequences.
A race condition when changing email addresses leads to forgery of verified addresses and the hijacking of third-party accounts via OAuth. Affected all versions prior to 15.5.7, from 15.6 to 15.6.4, and from 15.7 to 15.7.2. Please note: AC:L(Attack Complexity: Low) in the CVSS vector means the technical complexity of a single exploit is rated as low. However, CISA (SSVC Decision: Track) rates the vulnerability as non-automable (Automatable: no)—this is not a contradiction: AC:L describes the complexity of a single attack, while Automatable evaluates the possibility of mass/warm-like exploitation without operator intervention. EPSS 0.0066 (0.66%) means the absolute probability of exploitation is low, although the percentile of 0.5157 is slightly higher than the median among all CVEs in the database. No publicly available proof-of-concept exploits for this CVE have been recorded in open databases (Exploit-DB).
RCE via race condition in the temporary directory. Here AC:H(Attack Complexity: High) — the race window is narrow, requiring precise timing. Fixed in version 1.0.476. According to CISA, the technical impact is total — upon successful execution, the attacker gains complete control. EPSS 0.0146 (1.46%), percentile 0.7370 — above the CVE median, but the absolute probability of exploitation remains low.