CAPEC-29 / ATTACK-PATTERN
Leveraging Time-of-Check and Time-of-Use (TOCTOU) Race Conditions
This attack targets a race condition occurring between the time of check (state) for a resource and the time of use of a resource. A typical example is file access. The adversary can leverage a file access race condition by "running the race", meaning that they would modify the resource between the first time the target program accesses the file and the time the target program uses the file. During that period of time, the adversary could replace or modify the file, causing the application to behave unexpectedly.
- Category
- CAPEC patterns
- Version / scope
- CAPEC 3.9; release 2023-01-24; publisher status Draft
- Affected / relevant technologies
- Platform scope not specified separately in this source
- Evidence
- Documentation: pinned-source excerpt checked. Execution: not tested. Editorial: curated reference.
Defensive analysis and explicitly authorized assessment only. This website performs no scans, exploitation, model calls or infrastructure changes. Indicators below are investigation opportunities, not proof of compromise or guaranteed detectors.
Mechanism and prerequisites
A resource is access/modified concurrently by multiple processes. The adversary is able to modify resource. A race condition exists while accessing a resource.
Potential impact
Integrity Modify Data Confidentiality Access Control Authorization Gain Privileges Confidentiality Integrity Availability Alter Execution Logic Confidentiality Read Data Availability Resource Consumption Denial of Service
Versioned source scope
This record contains normalized, sometimes shortened source excerpts with editorial safety context. Markup and executable example blocks are omitted. Source-field verification does not establish device testing, a working detector or local applicability.
Publisher: MITRE. Release: CAPEC 3.9; release 2023-01-24; publisher status Draft. Source checked: 2026-11-18.
Source object: CAPEC-29. Object modified: 2022-09-29.
Attribution and source terms (© The MITRE Corporation; reproduced with permission)Detection and investigation
- No standalone detection method is provided in the selected source fields. Do not infer that absence of an alert establishes safety.
Preserve source timestamps, asset identity and collection context. Correlate independent evidence before attributing malicious intent. In OT, review passive evidence with the process owner; do not induce failures, replay commands or write to controllers to test a hypothesis.
Mitigation and response
- Use safe libraries to access resources such as files.
- Be aware that improper use of access function calls such as chown(), tempfile(), chmod(), etc. can cause a race condition.
- Use synchronization to control the flow of execution.
- Use static analysis tools to find race conditions.
Apply changes through the asset owner's approved change and recovery process. Documentation review is separate from successful testing or verified production protection.
Related technical context
No protocol-specific mapping is asserted for this entry.
Related security reading
Continue directly to another reference. Editorial reading connections do not assert official CWE/CAPEC/ATT&CK/OWASP equivalence or mappings.
Publisher-defined relationships
These directed relationships come from the pinned publisher data. They describe framework context, not guaranteed prevention, detection coverage or equivalence between entities.
Publisher weakness and attack-pattern relationships
These relationships retain the publisher's source attributes and view context; they do not establish that an attack or weakness applies to a particular system.
- CAPEC-27 → ChildOf → CAPEC-29 Open related reference
- CAPEC-29 → ChildOf → CAPEC-26 Open related reference
- CAPEC-29 → Related_Weakness → CWE-362 Open related reference
- CAPEC-29 → Related_Weakness → CWE-366 Open related reference
- CAPEC-29 → Related_Weakness → CWE-367 Open related reference
- CAPEC-29 → Related_Weakness → CWE-368 Open related reference
- CAPEC-29 → Related_Weakness → CWE-370 Open related reference
- CAPEC-29 → Related_Weakness → CWE-662 Open related reference
- CAPEC-29 → Related_Weakness → CWE-663 Open related reference
- CAPEC-29 → Related_Weakness → CWE-665 Open related reference
- CAPEC-29 → Related_Weakness → CWE-691 Open related reference
- CWE-362 → Related_Attack_Pattern → CAPEC-29 Open related reference
- CWE-366 → Related_Attack_Pattern → CAPEC-29 Open related reference
- CWE-367 → Related_Attack_Pattern → CAPEC-29 Open related reference
- CWE-368 → Related_Attack_Pattern → CAPEC-29 Open related reference
- CWE-370 → Related_Attack_Pattern → CAPEC-29 Open related reference
- CWE-662 → Related_Attack_Pattern → CAPEC-29 Open related reference
- CWE-663 → Related_Attack_Pattern → CAPEC-29 Open related reference
- CWE-665 → Related_Attack_Pattern → CAPEC-29 Open related reference
- CWE-691 → Related_Attack_Pattern → CAPEC-29 Open related reference
Authoritative sources and attribution
Identifiers and source titles belong to OWASP, MITRE, the CVE Program, CISA, NIST or the cited vendor. Source excerpts are attributed and adapted under the linked publisher license; editorial context is separate. This is not an official framework mirror. Review baseline: 2026-11-18. Live documents can change; check exact current applicability.
- Publisher reference: CAPEC-29 — source accessed 2026-11-18
- capec — source accessed 2026-11-18
Source review supports bounded reference text. It is not execution evidence, a completeness claim, a CVSS assessment, a compliance certification or verification of production security.
