Multi-Endpoint Races

Racing two different requests (or steps of a stateful flow) so one operation observes the half-applied result of another — TOCTOU abuse of a state machine, not multi-redeeming one resource.

How it works

Unlike Limit-Overrun Race Conditions (the same request fired N times), a multi-endpoint race sends distinct requests in parallel so that one runs during the brief sub-state another creates:

  • Thread A mutates identity/state bound to a shared key.
  • Thread B validates or acts on that key, reading the value before A’s mutation lands, then using the result after it does.

Because the two operations touch shared state on different threads, the attacker wins a window where the system is internally inconsistent: validated as one principal, acted on as another. Delivery is the Single-Packet Attack so both land together; for WebSocket-based flows, WebSocket Turbo Intruder’s THREADED engine opens one connection per message.

Variants

  • State-change races (auth step-skipping). A multi-step login keyed on a flowId: init-email/send-otp/check-otp can arrive in any order. Race init-email(victim email) against check-otp(attacker’s OTP): thread B validates the OTP as still-valid while thread A rebinds the flow to the victim, so the issued token belongs to the victim → full ATO (MFA Bypass, Account Takeover).
  • Check-then-act on verification (TOCTOU). if check_email_availability(new): add_collaborator(new) — request access under an email you don’t own; between check and use, a staff account on that email gets auto-attached. Shopify partner-confirmation bypass, H1 #300305, $15,250.
  • Validate-then-fetch (TOCTOU SSRF). App validates a hostname with one DNS lookup, then the HTTP client resolves it again at connect time. Flip the record in between → DNS Rebinding: the connect-time lookup returns 169.254.169.254. CVE-2026-87996 (Open-WebUI), CVE-2026-63440 (2FAuth), CVE-2026-77313 (validates resolved IP but connects by hostname). Fix: DNS pinning — resolve once, connect to that exact IP.
  • Dropped-state window. Discuz! X5.0 DB import drops common_member first; in that window userlogin() returns the “exists in ucenter but not common_member” branch for an admin, emitting a forged session authcode → auth bypass → LFI → pre-auth RCE.
  • Processing-pipeline race. A file/record is written, a sanitizer or deleter runs asynchronously; a second endpoint reaches the resource mid-processing. Save-then-delete uploads (Unrestricted File Upload); output sanitizer that runs after an <img> has already streamed (SearchLeak / EchoLeak); Discourse image pipeline file-swap widened via jpegoptim.

How to test

  1. Map the flow and the shared key (flowId, email, session, filename, hostname) that two endpoints both touch.
  2. Identify a check on one endpoint whose result another endpoint consumes.
  3. Send the two distinct requests in parallel via a Turbo Intruder gate / single-packet, not the same request repeated.
  4. Confirm the inconsistent outcome (authenticated as another user, resource attached, connect to blocked IP) and reproduce.
  5. Widen a too-narrow window: target a slower variant, add a large body, or route through a delegated processor.

Defenses

  • Make the whole multi-step transition atomic or transactional; don’t trust a value re-read after a gap.
  • Bind validation and action to the same immutable snapshot (re-check inside the same locked transaction; pin the resolved DNS IP).
  • Lock on the shared key for the duration of the flow; use idempotency/versioning on state transitions.
  • Don’t gate security on a later async pass (post-render sanitizer, after-the-fact delete).

Sources