race-condition
Skill20 starsChanged 4 months agoMITView on GitHub
Detects check-then-act sequences on shared state vulnerable to TOCTOU
11 other projects use a version of this.
Adopted by
Most recently taken up by
- mahumadad/quarrytheir own version, first seen Nov 8, 2026
- blacklanternsecurity/red-runtheir own version, first seen Oct 25, 2026
- ferr079/claude-code-cybersec-skillstheir own version, first seen Oct 12, 2026
- TaiMaBenJi/taima-skillstheir own version, first seen Oct 11, 2026
- zyphr-labs/bounty-harnesstheir own version, first seen Aug 26, 2026
- Kur1sulab/blackboxtheir own version, first seen Aug 12, 2026
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- yaklang/hack-skills★ 2.4ksame name
- blacklanternsecurity/red-run★ 296same name
- langbyyi/websec-skills★ 4same name
- Kur1sulab/blackbox★ 3same name
- JustineDevs/premortem★ 2same name
- mahumadad/quarry★ 1same name
- TaiMaBenJi/taima-skills★ 1same name
- zyphr-labs/bounty-harness★ 1same name
- ferr079/claude-code-cybersec-skills★ 0same name
- jgamaraalv/delivery-loop★ 0same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository52 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- authentication-failuresSkill
- broken-access-controlSkill
- concurrency-correctnessSkill
- contract-reviewSkill
- cryptographic-failuresSkill
- crypto-library-misuseSkill
- csrfSkill
- exceptional-conditionsSkill
- excessive-agencySkill
- file-uploadSkill
- graphql-securitySkill
- hardcoded-secretsSkill
- header-injectionSkill
- hotspotsSkill
- injectionSkill
- insecure-designSkill
- insecure-local-storageSkill
- insecure-output-handlingSkill
- insecure-plugin-designSkill
- integrity-failuresSkill
- ipc-securitySkill
- llm-supply-chainSkill
- logging-failuresSkill
- mass-assignmentSkill
- mcp-securitySkill
- memory-api-misuseSkill
- model-dosSkill
- model-theftSkill
- multi-agent-trustSkill
- nosql-injectionSkill
- numeric-trust-boundarySkill
- oauth-implementationSkill
- open-redirectSkill
- overrelianceSkill
- path-traversalSkill
- privilege-handlingSkill
- prompt-injectionSkill
- prototype-pollutionSkill
- pr-reviewSkill
- rag-securitySkill
- redosSkill
- security-cleanupSkill
- security-misconfigurationSkill
- security-reviewSkill
- sensitive-disclosureSkill
- ssrfSkill
- supply-chainSkill
- threat-modelSkill
- token-smugglingSkill
- training-data-poisoningSkill
- unsafe-api-consumptionSkill
The file
Files
Race Condition Security Check (CWE-362)
What this checks
Protects against time-of-check-to-time-of-use (TOCTOU) and other race conditions where concurrent access to shared state creates a window for attackers to manipulate data between a check and its corresponding action. Exploitation leads to privilege escalation, double-spend, and data corruption.
Vulnerable patterns
- File existence checked before opening, deleting, or creating — the file can be swapped between the check and the operation.
- Balance, quota, or counter read into memory, modified, then written back without locking or a transaction — concurrent updates lose writes or double-spend.
- "Does this username exist? if not, create it" with no database-level uniqueness constraint — two concurrent callers both see "no" and both create.
- Privilege or ownership checked in one call, then a separate later call performs the action on the same resource — the resource may have changed between calls.
Fix immediately
Flag the vulnerable code and explain the risk. Then suggest a fix that establishes these properties. Translate each property into the audited file's language, database driver, and filesystem API — use the platform's documented atomic primitives.
- No check-then-act sequence on shared state runs without atomicity. The check and the act collapse into a single atomic operation, or both sit inside a lock, transaction, or database-level guard. A read followed by a separate write is the exact bug — merge them into a conditional update that returns the affected row count.
- Balance, counter, and quota updates use atomic increments or compare-and-swap — never a read-modify-write sequence in application code. Under concurrency the read-modify-write loses every interleaved update; the database or atomic type is the correct place for the mutation.
- File operations that depend on existence use atomic primitives — exclusive-create flags, atomic rename, atomic link. A separate exists check followed by an open is TOCTOU-exploitable; the atomic flag short-circuits the window.
- Uniqueness constraints live in the database, not in application code. An "exists then create" pattern races two ways with itself; a uniqueness index plus an insert-and-catch-duplicate pattern is race-free by construction.
Verification
- No check-then-act sequence on shared state (files, database rows, in-memory counters) operates without atomicity — either a single atomic operation, a lock, or a database-level guard
- Balance/counter updates use atomic increments or compare-and-swap, not read-modify-write sequences
- File operations that depend on existence or state use atomic primitives (exclusive-create, atomic rename, atomic link) rather than check-then-act
- Uniqueness is enforced by a database constraint, not by an application-level exists-then-create pattern
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

