TOCTOU - Time-of-check to time-of-use
Updated 2026-07-30
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.
Introduction
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/3Practice this model in one real situation:
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
- baike.baidu.comhttps://baike.baidu.com/item/TOCTOUverified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS