Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M0112

TOCTOU - Time-of-check to time-of-use

TOCTOU - Time-of-check to time-of-use
DecideHigh supportDecision Science
Included
account_tree

Updated 2026-07-30

Loading revision record…

Summary

A software vulnerability that occurs when there is a time gap between the system checking a condition (such as file permissions) and actually using the resource, during which an attacker can exploit the gap to change the system state.

Definition

A software vulnerability that occurs when there is a time gap between the system checking a condition (such as file permissions) and actually using the resource, during which an attacker can exploit the gap to change the system state. Scaffold use: Beware of lag in dynamic changes. In real life, it is a microcosm of 'marking the boat to find the sword': when you finish your research (Check) and are ready to act (Use), the environment may have changed. The longer the interval between decision and execution, the greater the TOCTOU risk.

How to use

Beware of lag in dynamic changes. In real life, it is a microcosm of 'marking the boat to find the sword': when you finish your research (Check) and are ready to act (Use), the environment may have changed. The longer the interval between decision and execution, the greater the TOCTOU risk.

Mechanism

Distinguish between the 'time when the check (verification) occurs' and the 'time when the checked object is actually used'. When the two are separated, ensure that the property holds before use.

Practice

In progress 0/3

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%

Cases

  • Compile-time type checking vs. runtime contracts, pre-launch audit vs. online monitoring.

Common pitfalls

  • Assuming that once checked, it is always safe; ignoring runtime state drift; the disconnection between the two moments leads to vulnerabilities.
Sources

Source support: Explicit

  • link
    baike.baidu.comhttps://baike.baidu.com/item/TOCTOUZH · Explicit
    verified
account_treeGenealogyexpand_more

RELATED MODELS