detect-toctou-raceslisted
Install: claude install-skill umbrasec-labs/umbra-blue
# TOCTOU Race Conditions - Defensive Methodology
> **Tier 2 - methodology skill.** No bespoke UMBRASEC detection rule ships with this skill yet. It gives the defender's method, the log sources and signals, the hunt, and the hardening, and points to public rule sources. Promotion to Tier 1 (a sourced, tuned UMBRASEC rule) is tracked in [COVERAGE.md](https://github.com/umbrasec-labs/umbra-blue/blob/main/COVERAGE.md). Do not treat the content below as citing a UMBRASEC rule; there is none for this threat yet.
## TL;DR for defenders
A TOCTOU (time-of-check to time-of-use) bug is a race: a privileged process checks a path (does this file exist, who owns it, may I write it) and then acts on that path a moment later, and an unprivileged attacker swaps what the path points to in the gap between the two. The classic shape is a root or SYSTEM process that resolves a filename through a directory the attacker can write to (`/tmp`, `/var/tmp`, `/dev/shm`, `C:\ProgramData`, `%TEMP%`), letting the attacker redirect the privileged write into `/etc/passwd`, `/etc/shadow`, `/etc/sudoers.d/`, a cron directory, or a new setuid binary. You almost never catch the race itself, so detect its three edges: the precondition (a privileged process operating on a user-writable path), the attempt (an unprivileged account creating symlinks or hardlinks pointing at sensitive targets, often in a fast rename loop to widen the window), and the outcome (a privileged process writing to a file it should never t