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 Abstractions¶
Current abstraction Time-Of-Check To Time-Of-Use Flaw Prime
Parents (2) — more general patterns this builds on
-
Time-Of-Check To Time-Of-Use Flaw is a kind of Unverified Precondition Prime
Time-Of-Check To Time-Of-Use Flaw is a specialization of Unverified Precondition, retaining the parent's defining structure while adding the child's specific commitments.
-
Time-Of-Check To Time-Of-Use Flaw presupposes Verification Prime
Time-Of-Check To Time-Of-Use Flaw presupposes Verification, whose structure must already obtain for the child mechanism to be meaningful or operational.
Hierarchy paths (2) — routes to 2 parentless roots
- Time-Of-Check To Time-Of-Use Flaw → Unverified Precondition
- Time-Of-Check To Time-Of-Use Flaw → Verification → Evaluation → Comparison → Self Checking
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.