CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition

low-risk

The product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check.

Abstraction: Base

Common Consequences

Integrity Alter Execution Logic
Integrity Modify Application Data
Integrity Other
Non-Repudiation Hide Activities
Non-Repudiation Other
Other Unexpected State

Detection Methods

Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Real-World Examples (10)

CVE CVSS EPSS KEV
CVE-2022-3590 5.9 91.1%
CVE-2024-50379 9.8 86.5%
CVE-2023-38146 8.8 86.5%
CVE-2024-30088 7.0 84.8% Y
CVE-2024-30088 7.0 84.8% Y
CVE-2020-1337 7.8 55.3%
CVE-2025-22224 9.3 47.3% Y
CVE-2025-22224 9.3 47.3% Y
CVE-2019-0836 7.8 24.8%
CVE-2024-26218 7.8 24.6%
5
/ 100
low-risk
Active Threat 3/50 · Minimal
Exploit Availability 2/50 · Minimal