Race Condition Cheatsheet

Race Conditions

Quick reference

  • The single-packet attack (HTTP/2) is the most reliable technique for race conditions
  • Look for race conditions in: coupons, transfers, likes/votes, single-use tokens, rate limits
  • TOCTOU is common in filesystem operations: check permissions -> read file
  • For HTTP/1.1, use Turbo Intruder's last-byte sync as an alternative to single-packet
  • SQLite WAL files can hold data the main .sqlite doesn't

TOCTOU (Time-of-Check-Time-of-Use)

File system race (symlink)

1. Crear symlink: pwn -> /etc (directorio prohibido)
2. Alternar symlink entre directorio permitido y prohibido
3. fsAccess() verifica cuando apunta a permitido
4. createReadStream() lee cuando apunta a prohibido

Balance check-then-debit

1. Check balance: GET /api/balance -> $100
2. Enviar 10 requests simultaneas: POST /api/transfer (amount=100)
3. Todas pasan el check antes de que se aplique el debito
4. Resultado: $1000 transferidos con $100 de saldo

Coupon race condition

1. Enviar multiples requests simultaneas: POST /api/apply-coupon
2. El cupon de un solo uso se aplica multiples veces
3. Descuento multiplicado

Single-packet attack (HTTP/2)

ConceptJames Kettle - PortSwigger Research 2023

# HTTP/2 permite enviar multiples requests en un solo paquete TCP
# Todas llegan al servidor al mismo tiempo exacto
# Elimina jitter de red = race condition mas fiable

Turbo Intruder - single packet

def queueRequests(target, wordlists):
    engine = RequestEngine(endpoint=target.endpoint,
                           concurrentConnections=1,
                           engine=Engine.HTTP2)
    for i in range(20):
        engine.queue(target.req)
    engine.openGate('race1')

def handleResponse(req, interesting):
    table.add(req)

Last-byte sync (HTTP/1.1)Turbo Intruder technique for HTTP/1.1 servers

# Para HTTP/1.1 sin soporte de HTTP/2:
1. Enviar todos los requests menos el ultimo byte
2. Enviar todos los ultimos bytes simultaneamente
3. El servidor procesa todos al mismo tiempo

Limit bypass

Rate limit bypass

Enviar 100 requests en single packet para:
- Login brute force (bypass de rate limit)
- SMS/email flooding
- Voting/like manipulation
- Invite code generation

One-time use token reuse

1. Interceptar email con token de reset password
2. Enviar 20 requests simultaneas: POST /reset-password (con el token)
3. Al menos una pasa antes de que el token se invalide

2FA bypass

Enviar multiples requests con diferentes codigos 2FA simultaneamente
Si no hay bloqueo atomico, uno puede pasar

Advanced escalation

TOCTOU + symlinks via GitReal technique used in the n8n CVE for file read -> ATO

1. Crear repo Git con symlink en dos branches
2. Branch A: symlink -> directorio prohibido
3. Branch B: symlink -> directorio permitido
4. Workflow que alterna branches rapidamente
5. Leer archivo durante la ventana de carrera

JWT forging via race file read

1. Race condition -> leer database.sqlite + config
2. Extraer encryptionKey del config
3. Derivar JWT secret: SHA256(key[::2])
4. Forjar JWT para cualquier usuario -> ATO

WebSocket race condition

WebSockets son full-duplex -> enviar multiples mensajes simultaneos:
- Doble gasto en transferencias
- Bypass de rate limit por mensaje
- Operaciones no atomicas en estado compartido

Tools

Turbo Intruder

Burp extension with single-packet attack and last-byte sync support

Burp Suite > Extensions > Turbo Intruder > Send to Turbo Intruder

Repeater (parallel groups)

Send multiple Repeater requests in parallel with one click

Burp Suite > Repeater > Crear grupo > Send group in parallel

race-the-web

CLI tool for race condition testing with TOML config

race-the-web config.toml

Ready to practice?

Put these payloads to work in real labs based on bug bounty reports.

See practice labs
hunters training
650

hunters training

labs from real reports
50

labs from real reports

completions
380

completions

in bounties practiced
$200,000

in bounties practiced

40 flags captured this week·Real reports from HackerOne · Bugcrowd · Intigriti·No commitment·Free Academy
BBLabs · bug bounty training

Stop reading about bugs and start hunting them

Create your free account and practice on labs based on real reports that paid out thousands of euros. The Academy is free forever.

No card · free Academy · cancel anytime