security · vulnerability

TOCTOU

Also called: Time of check time of use

PathTerms

Definition

TOCTOU, or Time of Check Time of Use, is a software vulnerability that occurs when a program checks the state of a resource, like a file, and then uses that resource based on the check, but the resource's state changes between the check and the use. This race condition allows an attacker to exploit the window of opportunity between the initial validation and the subsequent action. Understanding TOCTOU is crucial for developers and security professionals to prevent unauthorized access or data corruption. For instance, a program might check if a user has permission to write to a file and then proceed to write, but an attacker could swap the file to a sensitive one during that brief interval. It is distinct from a simple access control failure because it involves a temporal dependency between checking and using a resource. This concept is frequently tested on cybersecurity certifications like CompTIA Security+ and CySA+.

Related terms

Related course suggestions

Related PathKey™ guides