Time-Of-Check To Time-Of-Use Flaw¶
Core Idea¶
A precondition is verified at one instant, the action it authorizes is taken at a later instant, and the relevant state changes in the gap — so the verdict goes stale and the defect lives in the temporal binding between check and use, not in either operation.
How would you explain it like I'm…
Someone Took The Chair
The Gap In Between
Stale-Permission Gap
Broad Use¶
- Security / concurrency: a process checks a file's ownership, then opens it, and an attacker swaps it for a symlink in between.
- Aviation: a runway is checked clear and clearance issued, and a vehicle enters before the roll begins.
- Medicine: pre-operative labs and consent obtained Monday for Wednesday surgery, after coagulation shifts or consent is revoked.
- Law: a warrant issued on facts true at the time, executed weeks later under changed circumstances.
- Finance: a credit check approves a loan that disburses a month later, after employment or fraud flags change.
- Industrial safety: a lockout-tagout verification confirms de-energization, but energization occurs before the worker reaches inside.
Clarity¶
Re-localizes the defect from "the check missed it" to "the temporal binding was not enforced," and pre-empts the useless response of adding more checks at t1 — the rigor of the check is orthogonal to the staleness of its verdict.
Manages Complexity¶
Compresses a concurrency or safety review into a three-question scan — what state was relied on, what could mutate it in the gap, what binds the act to state at execution — yielding a sorted family of binding-strength remedies.
Abstract Reasoning¶
Treats the temporal binding as first-class and arrays remedies on a continuum of binding strength: atomic re-check at use (strongest), lease-with-expiry, then check-once-and-trust (weakest), making the exposure-versus-cost trade explicit.
Knowledge Transfer¶
- Surgery: the WHO surgical "time-out" is structurally a database compare-and-swap — rebinding the action to state at the moment of action.
- Identity / logistics: bind to a stable substrate — a file descriptor over a path, a biometric over a badge, a sealed package over a manifest.
- Finance: a token TTL, a warrant's shelf life, and a rate-lock expiry are one intervention — leasing a verdict with explicit expiry.
Example¶
A privileged process runs access(path) at t1 (permitted), but before open(path) at t2 an attacker re-points the path to a system file; hardening access cannot help — the fix is to open first for a file descriptor, then check on the descriptor, an atomic check-and-act on an object that cannot be re-pointed.
Relationships to Other Primes¶
Parents (2) — more general patterns this builds on
- Time-Of-Check To Time-Of-Use Flaw is a kind of Unverified Precondition — The file names the relation in its Structural Signature: "the time-of-check-to-time-of-use gap is the time-window-sensitive INSTANCE" of the existence-precondition pattern. Direction: unverified_precondition is the general action-presumes-referent-exists-at-commit prime; TOCTOU (real candidate slug, listed cross-ref) is its time-window special case (check drifts stale between verification and use). Medium because TOCTOU is also a well-established standalone security concept; the in-file "instance" framing nonetheless supports a parent_of edge. NOT a reparent to constraint (0.815 nearest, unrelated).
- Time-Of-Check To Time-Of-Use Flaw presupposes Verification — A TOCTOU flaw presupposes a verification (a check rendering a verdict) whose result goes stale before a dependent action consumes it; the defect is the temporal binding between a sound check and its use, not the check's correctness. Built on the verify step — the file calls it 'the prime that names what verification cannot guarantee.'
Path to root: Time-Of-Check To Time-Of-Use Flaw → Verification
Not to Be Confused With¶
- TOCTOU Flaw is not Verification because verification asks whether a check is correct whereas the TOCTOU flaw stipulates a flawless check whose verdict went stale in the gap — so strengthening verification cannot fix it.
- TOCTOU Flaw is not Validation because validation asks whether the right thing was checked whereas TOCTOU is indifferent to that: the right property may be checked and the failure still occurs because the state mutated.
- TOCTOU Flaw is not Calibration because calibration drift is an instrument's accuracy degrading whereas TOCTOU is a correct measurement losing relevance because the measured state itself changed after the reading.