From appsec
This skill should be used when the user asks to "check for race conditions", "find TOCTOU bugs", "analyze concurrency issues", "detect double-spend vulnerabilities", "check for check-then-act patterns", "find shared state bugs", or mentions "race condition", "TOCTOU", "double-spend", "concurrency", "atomicity", or "thread safety" in a security context.
npx claudepluginhub florianbuetow/claude-code --plugin appsecThis skill uses the workspace's default tool permissions.
Analyze source code for race condition vulnerabilities including time-of-check
Acquire memory dumps from live systems/VMs and analyze with Volatility 3 for processes, networks, DLLs, injections in incident response or malware hunts.
Provides x86-64/ARM disassembly patterns, calling conventions, control flow recognition for static analysis of executables and compiled binaries.
Identifies anti-debugging checks like IsDebuggerPresent, NtQueryInformationProcess in Windows binaries; suggests bypasses via patches/hooks/scripts for malware analysis, CTFs, authorized RE.
Analyze source code for race condition vulnerabilities including time-of-check to time-of-use (TOCTOU), double-spend, check-then-act without locking, file system race conditions, shared state across async boundaries, and non-atomic counter operations. Race conditions are among the hardest bugs to detect through testing because they depend on timing, making static analysis essential.
Read ../../shared/schemas/flags.md for the full flag specification. This skill
supports all cross-cutting flags. Key flags for this skill:
--scope determines which files to analyze (default: changed)--depth standard reads code and checks for common race patterns--depth deep traces shared state across call graphs and async boundaries--severity filters output (race conditions are often high or critical)Key CWEs in scope:
Read references/detection-patterns.md for the full catalog of code patterns,
search heuristics, language-specific examples, and false positive guidance.
Parse flags and resolve the file list per ../../shared/schemas/flags.md.
Filter to files likely to contain race-prone logic:
**/services/**, **/handlers/**, **/models/**)**/payments/**, **/billing/**, **/wallet/**)**/storage/**, **/upload/**, **/fs/**)**/workers/**, **/tasks/**, **/jobs/**)**/counters/**, **/state/**, **/cache/**)Detect scanners per ../../shared/schemas/scanners.md:
semgrep -- primary scanner for concurrency patternsgo vet -- Go-specific race detection heuristicsbandit -- Python threading and synchronization issuesRecord which scanners are available and which are missing.
If semgrep is available, run with rules targeting concurrency:
semgrep scan --config auto --json --quiet <target>
Filter results to rules matching race condition, TOCTOU, and concurrency patterns. Normalize output to the findings schema.
Regardless of scanner availability, perform manual code analysis:
When --depth deep, additionally trace:
Format output per ../../shared/schemas/findings.md using the RACE prefix
(e.g., RACE-001, RACE-002).
Include for each finding:
These are the high-signal patterns specific to race conditions. Each maps
to a detection pattern in references/detection-patterns.md.
TOCTOU in file operations -- Checking file existence or permissions then operating on the file in a separate call.
Double-spend / check-then-debit -- Reading a balance, comparing it, then debiting in separate non-atomic steps.
Check-then-act without lock -- Any pattern where a condition is checked and the result is assumed to hold when the action executes.
Shared state across await -- Reading mutable state, yielding execution (await/yield), then using the stale value.
Non-atomic read-modify-write -- Counter increments, sequence generators, or flag toggles without synchronization.
Missing database transaction isolation -- Financial operations using default (READ COMMITTED) isolation when SERIALIZABLE is needed.
Parallel iteration over shared collection -- Modifying a shared list, map, or set from concurrent goroutines, threads, or async tasks.
| Scanner | Coverage | Command |
|---|---|---|
| semgrep | TOCTOU file ops, non-atomic patterns | semgrep scan --config auto --json --quiet <target> |
| go vet | Go race condition heuristics | go vet -race ./... |
| bandit | Python threading issues | bandit -r <target> -f json -q |
Fallback (no scanner): Use Grep with patterns from references/detection-patterns.md
to find check-then-act patterns, file stat calls, counter operations, and
async state access. Report findings with confidence: medium.
Use the findings schema from ../../shared/schemas/findings.md.
RACE (e.g., RACE-001)race-conditionsspecializedRACECWE-362, CWE-367T (Tampering) or E (Elevation of Privilege)Severity guidance for this category: