Fact-checked by Grok 2 weeks ago

Time-of-check to time-of-use

Time-of-check to time-of-use (TOCTOU), also abbreviated as time-of-check time-of-use (TOCTTOU), is a class of software vulnerabilities stemming from race conditions in which a program verifies the state of a —such as a , location, or shared —at one moment and then relies on that state during a subsequent operation, allowing an attacker to alter the in the intervening period and thereby circumvent intended measures. These vulnerabilities are especially common in environments with asynchronous or multi-threaded to shared resources, including UNIX-style s where weak semantics enable exploits like attacks in s that check file permissions before opening them. For instance, a might use system calls like access() to verify a file's or , followed by open() or fopen() to use it, creating a window for substitution with a malicious file. Historical analysis has identified over 224 vulnerable file call pairs in such systems, with real-world impacts documented in more than 20 CERT advisories between 2000 and 2004, many of which enabled unauthorized root in applications like sendmail, rpm, vi, and emacs. The exploit likelihood for TOCTOU issues is rated as medium, depending on factors like the duration of the check-to-use gap and the attacker's ability to control timing, though it poses significant risks in privilege-escalation scenarios. Mitigation strategies emphasize avoiding separate check-and-use patterns altogether, employing atomic operations where possible, implementing fine-grained locking mechanisms, or redesigning code to minimize temporal separation, as outlined in secure coding standards like CERT C guideline FIO01-C. Despite ongoing research into detection tools and kernel-level protections, TOCTOU remains a persistent in modern software, including emerging contexts like containerized environments and agents.

Overview

Definition

A time-of-check to time-of-use (TOCTOU) , also known as a TOCTTOU , arises when a program verifies the state or condition of a at one point in time but then relies on that verification when accessing or utilizing the at a later point, during which an attacker can modify the 's state to invalidate the earlier check. This temporal discrepancy creates a window of opportunity for exploitation, particularly in systems lacking proper synchronization mechanisms. The consists of three primary components: the , where the performs a such as testing permissions, , or ; the use , where the acts on the resource based on the assumed validity of the , such as opening or modifying it; and the critical time gap between these s, which allows external interference without operations to bridge them. In essence, the establishes a that the use assumes to hold, but without safeguards, this assumption fails if the state changes intervening. To illustrate the , consider a simple sequence in where a checks write to a before attempting to write to it, without :
if (access("file", W_OK) == 0) {
    fd = open("file", O_WRONLY);
    write(fd, buffer, size);
    close(fd);
}
Here, the access call represents the check phase, while open and write form the use phase; an attacker could replace the between these steps, potentially leading to unintended actions on a different . TOCTOU differs from general race conditions by specifically emphasizing the security implications of this temporal separation in check-then-use patterns, often in contexts like file systems or shared resources, rather than mere concurrent access without a verification step. It is classified as a subtype of broader concurrency issues, focusing on the exploitability of the verification-use gap in security-critical operations.

Security Implications

Time-of-check to time-of-use (TOCTOU) vulnerabilities create a critical window of exploitability that can lead to severe breaches by allowing attackers to manipulate resources between the verification and utilization phases. This temporal gap enables adversaries to alter the state of checked resources, resulting in unauthorized actions that compromise system integrity. The primary impacts include , where attackers gain elevated access by exploiting the discrepancy to assume unauthorized identities or execute privileged operations; data corruption, through unintended modifications to files or memory; unauthorized access, permitting read or write operations on restricted resources; and denial-of-service, by inducing invalid states that crash applications or exhaust resources. These consequences affect core aspects of security, such as , , , , and . TOCTOU flaws manifest across diverse contexts, including operating systems where kernel-level checks on processes or tokens can be raced; file systems, particularly involving directory traversals or symlink manipulations; network protocols, during state validations in concurrent communications; and multi-threaded applications, where accesses amplify race risks. In these environments, the vulnerability's likelihood of exploit is rated as medium due to the need for precise timing, yet its prevalence in critical software heightens overall exposure. In real-world scenarios, TOCTOU vulnerabilities frequently underpin high-impact exploits in security-critical software, with associated Common Vulnerabilities and Exposures (CVEs) often assigned CVSS v3.1 base scores ranging from 7.0 to 8.5, signifying high to critical severity—for example, CVE-2024-30088 in the Windows kernel scores 7.0, while CVE-2025-55236 in the Windows Graphics Kernel scores 7.8. Such ratings underscore the potential for widespread harm when exploited in production systems. Systemically, TOCTOU defects contribute to broader attack chains by enabling initial footholds that cascade into more devastating compromises, such as zero-day privilege escalations or disruptions in containerized environments akin to risks during image unpacking. For instance, they have been chained in actively exploited zero-days to bypass protections and facilitate lateral movement.

History and Evolution

Origins

The concept of time-of-check to time-of-use (TOCTOU) vulnerabilities traces its roots to early analyses of operating system security flaws in the 1970s, particularly in multi-user systems like and nascent Unix implementations. These systems featured permission models that separated resource validation from access, creating gaps exploitable by concurrent processes. The RISOS project, conducted by the National Bureau of Standards, identified such issues as a form of improper in its 1976 report on computer operating system vulnerabilities, explicitly describing the "time-of-check to time-of-use" problem where a system's validation of a resource state could be invalidated by changes before the resource is used. Similarly, the Protection Analysis (PA) project at the University of Southern California's Information Sciences Institute, in its 1978 final report, classified TOCTOU as a subclass of timing and errors, emphasizing residual inconsistencies in resource allocation and deallocation within environments. By the 1980s, studies on race conditions in early Unix systems further illuminated these gaps, noting how permission checks in file access models allowed attackers to manipulate shared resources between validation and utilization. These precursors laid the groundwork for recognizing TOCTOU as a systemic issue in concurrent, multi-user operating systems, where non-atomic operations exposed security boundaries. The problems were particularly evident in Unix's semantics, which relied on sequential checks without inherent mechanisms to prevent interleaving by malicious or competing processes. The term TOCTOU (or more fully, TOCTTOU) gained prominence in the amid growing awareness of file access races in contexts. A seminal paper by Matt Bishop and Michael Dilger, published in Computing Systems, provided one of the earliest detailed examinations under this nomenclature, analyzing TOCTTOU binding flaws in Unix utilities such as xterm and passwd. The authors modeled detection methods for these races, highlighting their prevalence in real-world exploits like unauthorized password file modifications, and built on prior taxonomies to formalize the vulnerability in modern multi-user deployments. This work marked a key milestone in naming and categorizing the issue, focusing initially on semantics where object identifiers could change post-check. The evolution of TOCTOU awareness was triggered by the proliferation of networked, multi-user systems, which amplified concurrent access risks and underscored the need for robust in permission models. As Unix variants became widespread in academic and commercial settings, vulnerabilities in check-use gaps transitioned from theoretical concerns to practical threats, prompting dedicated research into their mechanics and detection.

Notable Developments

In the , TOCTOU vulnerabilities gained prominence through numerous incidents in Unix-style systems, with the issuing 20 advisories between 2000 and 2004 documenting such flaws in software like and , often involving file access races that enabled . A key example from the emerged in Android's permission system, where naming allowed malicious apps to exploit TOCTOU gaps between permission checks and access, as detailed in a 2014 analysis revealing vulnerabilities in app installation and data sharing processes. Research advancements from 2005 to 2015 focused on modeling and mitigating TOCTOU through systematic analysis, with the 2005 paper "TOCTTOU Vulnerabilities in UNIX-Style File Systems" enumerating 224 vulnerable file system call pairs, analyzing 20 CERT advisories, identifying 26 new vulnerabilities in applications, and proposing kernel-level defenses like calls to prevent races in file operations. Building on this, the 2008 work "TOCTOU, Traps, and " explored formal models for trusted platform modules, highlighting timing attacks in attestation and advocating for synchronized check-use mechanisms in hardware-enforced . The 2010 paper "Modeling and Preventing TOCTTOU Vulnerabilities in Unix-style File Systems" surveyed 20 CERT advisories from 2000-2004, noting 11 enabled unauthorized access, and proposed the EDGI using with overheads ranging from 0.25% to 47% in benchmarks. In modern , TOCTOU risks have surfaced in resource provisioning, such as a 2024 vulnerability in where attackers exploited races between validation and deployment to inject malicious roles, potentially leading to account takeover across six services including S3 manipulation. Similarly, containerized environments have seen notable cases, like the 2020 Kubernetes , a TOCTOU flaw in the server proxy that allowed authorized users to bypass network restrictions and access private control-plane endpoints in versions 1.18.18 to 1.21.0. In Docker ecosystems, a 2020 analysis demonstrated TOCTOU exploitation via mutable image tags, enabling attackers to swap benign containers with malicious ones during pull operations in deployments. Post-2020 updates underscore TOCTOU's ongoing relevance in operating systems, exemplified by CVE-2020-25212 in the kernel's NFS client, a TOCTOU mismatch allowing local attackers to corrupt non-root-owned files via manipulated directory entries, affecting kernels before 5.8.3 and patched through locking enhancements. This incident highlights persistent challenges in file operations, with similar races noted in subsequent audits of kernel subsystems like . In 2025, a critical TOCTOU vulnerability (CVE-2025-22224) was disclosed in vCenter Server, enabling attackers to execute code on the from a . Additionally, products on Windows were affected by a TOCTOU , patched in July 2025.

Examples and Types

File System Vulnerabilities

File system vulnerabilities represent a primary domain for time-of-check to time-of-use (TOCTOU) exploits, where non-atomic operations on files allow attackers to manipulate resources between verification and utilization phases. In systems, these issues arise due to the separation of pathname resolution and file operations, enabling races that compromise security boundaries such as and permissions. Such vulnerabilities often lead to unauthorized data access or modification, with attackers exploiting symbolic links (symlinks) to redirect operations to sensitive targets. A classic example is the symlink attack, in which a privileged program verifies a file's attributes before accessing it, only for an attacker to replace the target with a symlink pointing to a protected file during the intervening period. For instance, in , the program checks a user's file for validity using stat() before appending new messages; an attacker can swap the mailbox with a symlink to /etc/passwd, allowing the append operation to inject unauthorized entries as , potentially granting elevated privileges. This exploit succeeds because the does not atomically link the check to the use, creating a window for manipulation estimated at microseconds to milliseconds depending on system load. The mechanics of this vulnerability can be illustrated through a step-by-step breakdown in a Unix environment, typically involving stat() for the check and open() for the use:
  1. The program resolves a pathname (e.g., /tmp/target) and calls stat() to verify attributes like ownership or existence, storing the results in a structure.
  2. Between the stat() return and the subsequent open() call, an attacker monitors the process (e.g., via signals or polling) and replaces /tmp/target with a symlink to a sensitive file (e.g., /etc/shadow).
  3. The open() call then follows the symlink, operating on the unintended target with the program's privileges.
Pseudocode demonstrating this vulnerable pattern in C is as follows:
#include <sys/stat.h>
#include <fcntl.h>

void vulnerable_function(const char *pathname) {
    struct stat sb;
    if (stat(pathname, &sb) == -1) {
        // Handle error
        return;
    }
    if (sb.st_uid != getuid()) {  // Check ownership
        // Deny access
        return;
    }
    // TOCTOU gap here: Attacker can replace pathname with symlink
    int fd = open(pathname, O_WRONLY);  // Opens unintended file
    // Write to fd as privileged user
    close(fd);
}
This sequence, common in utilities like rpm or vi, has been confirmed exploitable with success rates up to 85% under controlled conditions. Variants of these exploits include directory traversal TOCTOU during path resolution, where attackers alter directory components mid-resolution to bypass restrictions. In Unix systems, path traversal involves iterative lookup of directory entries to map a pathname to an inode; if a check (e.g., permission validation on a parent directory) precedes full resolution, an attacker can rename or symlink a directory segment, redirecting the path to unauthorized areas. This requires changing the pathname-to-disk-block mapping between operations, a core weakness in the Unix virtual file system model. Equivalent issues exist in Windows , where TOCTOU races in file handling can lead to information disclosure or . For example, a in attribute processing allows local attackers to exploit gaps between checks and uses, similar to symlink redirection but leveraging reparse points or junctions; CVE-2025-50158 describes such a flaw enabling unauthorized access to sensitive data via non-atomic file operations. Historically, 1990s Unix mail spooler exploits exemplified these risks, often leading to access. In BSD-derived systems like , the binmail program suffered a TOCTOU in appending to spool files: it used lstat() to check a (e.g., /usr/spool/mail/user) before writing as root, allowing attackers to replace it with a symlink to /etc/passwd and append malicious entries for . Similar flaws in passwd utilities enabled .rhosts creation via symlink races, widespread until patches in the mid-1990s; these cases prompted early CERT advisories and tools for detection.

Network and Process Examples

In network protocols, TOCTOU vulnerabilities arise when a DNS resolver checks the time-to-live () value of a cached entry to verify its validity but subsequently uses the entry after it has expired due to a . This gap can enable attackers to exploit stale or spoofed records. For example, DNS entries with TTL=0 can trigger TOCTOU in address validation, allowing server-side request forgery (SSRF) attacks where the resolved changes between check and use, as seen in CVE-2018-3759 affecting certain gems. In inter-process scenarios, TOCTOU flaws often occur during privilege management in multi-threaded or concurrent applications, where a on credentials or is performed, but another thread or process alters the before use, leading to incorrect . This stems from non-atomic operations in systems, allowing escalation if sensitive actions rely on the stale . A contemporary example appears in microservices-based cloud environments, where validation is susceptible to TOCTOU due to distributed latencies. A gateway service may verify a 's and expiration upon receipt, but high network delays in cloud infrastructures can allow the to be forwarded and used in a downstream service after revocation or invalidation. In clusters, without the --service-account-lookup flag enabled, service account s are not validated against etcd for existence, potentially allowing use after associated ServiceAccount deletion and enabling unauthorized access. These network and process instances differ from file-based TOCTOU by emphasizing distributed timing across components or over networks, rather than local atomicity failures, which amplifies challenges from variable latencies and concurrent distributed operations.

Memory and Shared Data Examples

TOCTOU vulnerabilities also manifest in and shared data structures, particularly in multi-threaded programs lacking proper . For instance, a may check if a shared pointer is valid (non-null) before dereferencing it, but another frees the memory in the interim, leading to use-after-free errors that can cause crashes or . This is common in languages like C/C++ without atomic operations, as highlighted in secure coding guidelines. Real-world impacts include buffer overflows in libraries like glibc's malloc implementation, where race conditions between allocation checks and uses enable exploitation.

Technical Aspects

Race Condition Mechanics

A time-of-check to time-of-use (TOCTOU) arises in a two-phase model where a first performs a conditional , or "check," to assess the state of a —such as confirming permissions or —and then executes an unconditional action, or "use," on that assuming the checked state persists. This separation creates an exploitable time gap, known as the delta-t, during which an attacker can alter the resource's state, leading to unintended behavior such as unauthorized access. Several factors enable these races in practice. Concurrency models, including multi-threaded applications, , and hardware interrupts, allow parallel execution that can modify shared resources between the check and use phases. Additionally, non-atomic operations in operating system APIs, such as sequential system calls like access() followed by open() using pathnames rather than file descriptors, fail to guarantee atomicity, permitting binding changes in directories or files. These vulnerabilities are particularly prevalent in Unix-style file systems where weak synchronization primitives exacerbate the issue. The window of vulnerability can be mathematically represented as the time difference between the use and check phases: \Delta t = t_{use} - t_{check} where t_{check} is the of the verification and t_{use} is the of the action; this \Delta t quantifies the during which an exploit is feasible, often measured in milliseconds and varying with system load or . Detecting TOCTOU races presents significant challenges due to their non-deterministic nature, which depends on timing, scheduling, and environmental factors like permissions. Stress testing under high concurrency can reveal some instances, but —such as static analysis of pairs or dynamic monitoring of binding s—are often required for comprehensive identification, though they remain incomplete per on undecidability. These approaches incur overhead, typically a few percent for dynamic tools, and necessitate knowledge of the runtime to distinguish exploitable s.

Timing Challenges

Timing challenges in time-of-check to time-of-use (TOCTOU) vulnerabilities arise primarily from the inherent non-determinism of the interval between the check and use operations, often referred to as , which can fluctuate unpredictably across executions. This variability stems from hardware factors such as differences in CPU speeds, hierarchies, and handling, which can introduce delays ranging from microseconds for misses to longer periods influenced by processor architecture and load. For example, effects and during process operations can significantly alter the effective timing window for state changes. Operating system scheduling exacerbates these issues by introducing preemption, I/O wait times, and competition from threads like network time daemons or swappers, potentially extending Δt to seconds under high system load. Environmental factors, including and characteristics such as size or fragmentation, further contribute to this unpredictability, making consistent reproduction of the difficult. In distributed or ed contexts, additional from communication delays across devices widens the TOCTOU window, complicating inter-device . Exploiting TOCTOU demands precise timing from attackers to ensure their modifications occur within these narrow windows, typically on the scale, as the success of interleaving operations with the victim process relies on "winning the race" against timing. Variability reduces reliability, with empirical success rates varying widely—for instance, up to 85% in scenarios leveraging predictable scheduling quirks like those in package managers, but dropping to 4-8% in others, such as text editors affected by I/O variability. Attackers may employ techniques such as repeated invocation of calls or manipulation of process priorities to probe and align with these windows, though such methods require deep knowledge and often fail due to the non-deterministic nature of the environment. Analysis and detection of TOCTOU pose significant hurdles because of this non-determinism, rendering vulnerabilities hard to reproduce and identify in practice. Static analysis tools falter as they cannot account for dynamic state changes induced by concurrent attackers or environmental shifts, while dynamic detectors like ThreadSanitizer, which target memory data races using happens-before tracking, often miss TOCTOU involving file systems or external resources and generate false positives in timing-sensitive code due to their overhead, limiting applicability in production environments, and the tools' focus on intra-process races leaves inter-process or kernel-mediated TOCTOU largely undetected.

Prevention Strategies

Atomic Operations

Atomic operations represent a fundamental technique for mitigating time-of-check to time-of-use (TOCTOU) vulnerabilities by executing the check and subsequent use phases as a single, indivisible unit, thereby preventing any intervening state changes that could be exploited by concurrent processes or threads. This approach ensures that the resource's state at the time of directly determines its state during utilization, closing the temporal gap inherent in non-atomic sequences. In practice, such operations leverage hardware or system-level primitives that are guaranteed to complete without interruption, making them essential for secure concurrent programming. In systems, file operations exemplify this concept, such as using fcntl() advisory locks to serialize access to s and prevent races during read-modify-write cycles. These locks, applied via file descriptors, allow a to acquire exclusive control over a file , ensuring that checks for or permissions are followed immediately by the intended use without external interference. Similarly, POSIX-compliant like rename(2) provide renaming or replacement of s within the same filesystem, where the either succeeds fully or fails without partial effects, thus avoiding TOCTOU exposures in scenarios like secure file updates. For multithreaded environments, (CAS) instructions offer a lock-free mechanism to update shared variables only if their current value matches an expected one, directly addressing TOCTOU-like races in memory access. In , the __sync_bool_compare_and_swap builtin implements this by atomically comparing the value at a pointer with an expected value and swapping in a new value if they match, returning a indicating success. This primitive underpins many concurrent data structures, ensuring thread-safe modifications without traditional locks. To illustrate, consider a non-atomic file check-use sequence vulnerable to TOCTOU:
if (access("/path/to/file", F_OK) == 0) {
    // Attacker could replace file between access and open
    fd = open("/path/to/file", O_RDONLY);
    // Use fd...
}
An atomic alternative uses file descriptor-based operations post-initial open, or leverages rename(2) for replacement:
fd = open("/path/to/tempfile", O_WRONLY | O_CREAT | O_EXCL, 0600);  // Atomic creation
// Write to fd...
close(fd);
if (rename("/path/to/tempfile", "/path/to/file") == -1) {
    // Handle failure; original file unchanged
}
In multithreading, a non-atomic update might be:
if (*shared_counter == 5) {
    *shared_counter = 6;  // Race possible here
}
The CAS equivalent ensures atomicity:
if (__sync_bool_compare_and_swap(&shared_counter, 5, 6)) {
    // Update succeeded only if value was 5
}
Despite their efficacy, atomic operations have limitations that must be considered in TOCTOU prevention. For instance, rename(2) is only atomic when source and destination reside on the same filesystem; cross-filesystem moves require non-atomic copy-and-unlink sequences, reintroducing potential races. Furthermore, in performance-critical paths, atomic primitives like CAS can incur overhead due to hardware-level retries in contended scenarios, potentially degrading throughput compared to coarser-grained locking.

Best Practices and Tools

To mitigate time-of-check to time-of-use (TOCTOU) vulnerabilities, design principles emphasize minimizing the temporal gap between resource checks and uses while adhering to least privilege and models. Developers should avoid binaries where possible, as they amplify risks by granting elevated privileges during vulnerable windows, and instead opt for privilege separation to limit the scope of potential exploits. Capability-based systems, which enforce fine-grained access through unforgeable tokens, reduce TOCTOU exposure by ensuring resources are referenced immutably without relying on transient state checks. In coding practices, validation should occur at the point of use rather than beforehand to eliminate the race window; for file operations, this involves opening files once and performing all subsequent actions via file descriptors instead of pathnames, ensuring atomicity without intermediate checks. For database interactions, employing ACID-compliant transactions with isolation levels like Serializable or Repeatable Read prevents concurrent modifications that mimic TOCTOU by serializing access and locking resources during critical sections. Synchronization mechanisms, such as mutex locks for shared resources or transactional file systems, further bridge check-use gaps in multi-threaded environments. Tools for TOCTOU prevention include static analyzers like , which flags separated check-use patterns in C/C++ code via rule S5847, and , which detects race conditions in privileged programs such as binaries. Runtime detectors like Valgrind's Helgrind identify unsynchronized memory accesses that enable TOCTOU races in threaded applications by tracing lock acquisitions and data conflicts. Modern languages like mitigate risks through built-in concurrency traits (Send and Sync), which enforce thread-safe resource handling and warn against TOCTOU-prone file metadata operations in the standard library. These tools integrate into CI/CD pipelines, such as Jenkins or GitHub Actions, for automated scanning during builds to catch vulnerabilities early. Emerging methods leverage tools like TLA+ to model and prove absence of timing-dependent races in concurrent systems, providing mathematical guarantees against TOCTOU in distributed or kernel-level code. In containerized environments, profiles enforce mandatory access controls that restrict symlink creation and file manipulations, thereby limiting exploitation of TOCTOU races. Recent research as of 2025 has also explored mitigations for TOCTOU in LLM-enabled agents, such as tool-fusing strategies that combine validation and execution in tool calls to prevent races in AI systems.

References

  1. [1]
    CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition
    CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition. Weakness ID: 367. Vulnerability ... The TOCTTOU acronym expands to "Time Of Check To Time Of Use".
  2. [2]
    None
    ### Summary of TOCTTOU Vulnerabilities in UNIX-Style File Systems
  3. [3]
  4. [4]
  5. [5]
    CVE-2025-55236 Detail - NVD
    Sep 9, 2025 · NIST CVSS score. NIST: NVD. Base Score: 7.8 HIGH. Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H. Nist CVSS score does not match with CNA ...
  6. [6]
    Vulnerability Metrics - NVD
    The National Vulnerability Database (NVD) provides CVSS enrichment for all published CVE records. The NVD supports Common Vulnerability Scoring System (CVSS) v2 ...CVSS v2.0 Calculator · CVSS v3 Calculator · CVSS Base Score Equation
  7. [7]
    CVE-2025-47290 Detail - NVD
    May 20, 2025 · A time-of-check to time-of-use (TOCTOU) vulnerability was found in containerd v2.1.0. While unpacking an image during an image pull, specially crafted ...
  8. [8]
    Zero-Day Exploits Hit Windows 11, VMware ESXi, and Firefox
    May 19, 2025 · In one particularly impressive demonstration, team members Dung and Nguyen exploited a time-of-check-to-time-of-use (TOCTOU) race condition ...
  9. [9]
  10. [10]
    [PDF] Security analysis and enhancements of computer operating systems
    Apr 15, 1976 · This is sometimes called the "time-of-check to time-of-use" problem. As described under the implied sharing of privileged data flaw, an operating system may.
  11. [11]
    [PDF] Protection Analysis: Final Report - CSRC
    May 13, 1978 · Hol876 Hollingworth, D. and R. Bisbey II, Protection Errors in Operating Systems: Allocation/Deallocation Residuals, Information Sciences ...Missing: Hollingsworth | Show results with:Hollingsworth
  12. [12]
    None
    ### Summary of Origins and Early Discussion of TOCTOU in Unix Security
  13. [13]
    [PDF] TOCTTOU Vulnerabilities in UNIX-Style File Systems - USENIX
    TOCTTOU (Time Of Check To Time Of Use) is a well known security problem [1] in file systems with weak synchronization semantics (e.g., Unix file system). A.<|control11|><|separator|>
  14. [14]
    [PDF] Permission based Android security: Issues and countermeasures
    The vulnerability of TOCTOU (Time of Check to Time of Use) exists in Android mainly due to naming collusion. No naming rule or constraint is applied to a new ...
  15. [15]
    [PDF] TOCTOU, Traps, and Trusted Computing
    However, this design admits potential for time-of-check time-of-use vulnerabilities: a PCR reflects the state of code and data when it was measured, not when ...
  16. [16]
    Modeling and preventing TOCTTOU vulnerabilities in Unix-style file ...
    TOCTTOU (Time-of-Check-To-Time-Of-Use) is a file-based race condition in Unix-style systems and characterized by a pair of file object access by a ...
  17. [17]
    Bucket Monopoly: Breaching AWS Accounts Through Shadow ...
    Aug 9, 2024 · In this blog, we thoroughly explain the “Shadow Resource” attack vector, which may lead to resource squatting, and the “Bucket Monopoly” technique.
  18. [18]
  19. [19]
    Attack of the mutant tags! Or why tag mutability is a real security threat
    Jun 23, 2020 · Let's analyze a case where an attacker could exploit a TOCTOU bug to run malicious software in your cluster, even when using a Kubernetes ...
  20. [20]
    CVE-2025-50158 Detail - NVD
    Aug 12, 2025 · Time-of-check time-of-use (toctou) race condition in Windows NTFS allows an unauthorized attacker to disclose information locally. Metrics. CVSS ...
  21. [21]
    [PDF] Checking for Race Conditions in File Accesses
    The attack tool “runrace” sends mail to root, and as that mail is being delivered tries to replace “/usr/spool/rootlog” with “/etc/pwd/shadow”. If the ...
  22. [22]
    CVE-2008-1447: DNS Cache Poisoning Issue ("Kaminsky bug")
    Jul 8, 2008 · A weakness in theDNS protocol may enable the poisoning of caching recurive resolvers with spoofed data.DNSSEC is the only full solution.
  23. [23]
    [PDF] The Hitchhiker's Guide to DNS Cache Poisoning
    Kaminsky's attack more serious than “conventional” DNS forgery [19]. First, the attacker can force the target resolver to initiate a query to an ...
  24. [24]
    Fixing Races for Fun and Profit: How to use access(2) - USENIX
    Unfortunately, there is a classic time-of-check-to-time-of-use (TOCTTOU) [11] ... A somewhat improved approach is to fork off a child process, have that ...
  25. [25]
    The API server should validate the service account token in etcd
    This allows using a service account token even after the corresponding service account is deleted. This is an example of time of check to time of use security ...
  26. [26]
    [PDF] Checking for Race Conditions in File Accesses - nob.cs.ucdavis.edu!
    Checking for Race Conditions in File Accesses. Matt Bishop, Michael Dilger. Department of Computer Science. University of California at Davis. Davis, CA 95616 ...
  27. [27]
    TOCTOU Resilient Attestation for IoT Networks - ACM Digital Library
    May 9, 2025 · Remote attestation (RA), a well-established security service, detects malware on remote devices by verifying the integrity of their software ...
  28. [28]
    [PDF] ThreadSanitizer – data race detection in practice - Columbia CS
    This pa- per presents ThreadSanitizer – a dynamic detector of data races. We describe the hybrid algorithm (based on happens- before and locksets) used in the ...Missing: TOCTOU | Show results with:TOCTOU
  29. [29]
    7.10. Avoid Race Conditions
    Another approach to locking is to use POSIX record locks, implemented through fcntl(2) as a ``discretionary lock''. These are discretionary, that is, using ...
  30. [30]
    fcntl(2) - Linux manual page - man7.org
    fcntl() manipulates a file descriptor, performing operations like duplicating, setting flags, locking, and managing signals.Missing: TOCTOU | Show results with:TOCTOU
  31. [31]
    __sync Builtins (Using the GNU Compiler Collection (GCC))
    These built-in functions perform the operation suggested by the name, and returns the value that had previously been in memory.
  32. [32]
    Lockless patterns: an introduction to compare-and-swap - LWN.net
    Mar 12, 2021 · A compare-and-swap operation comprises a load and a store; for the sake of this article, you can consider them to be, respectively, load-acquire and store- ...
  33. [33]
    [PDF] Writing Secure Privileged Programs - man7.org
    Avoiding setuid-root: Privilege separation. ○. Isolate functionality ... Write code so as to avoid TOCTOU races; e.g.: ○ Program (temporarily) drops ...
  34. [34]
    [PDF] Analysing Object-Capability Security
    This is an example of a race condition that exhibits itself as a time-of-check-time-of-use (TOCTOU) vulnerability. It shows that patterns can exhibit subtle ...
  35. [35]
    Winning the race against TOCTOU vulnerabilities in C & C++ - Sonar
    Oct 7, 2020 · We've introduced rule S5847, Accessing files should not introduce TOCTOU vulnerabilities, for C, C++, and Objective-C (more languages "soon"!) to detect TOCTOU ...Missing: pseudocode | Show results with:pseudocode<|control11|><|separator|>
  36. [36]
    A Race to the Bottom - Database Transactions Undermining Your ...
    Jul 11, 2024 · Such concurrent modification will be prevented by the database by setting a lock on the modified entry, protecting the change until the ...
  37. [37]
    Coverity - TOCTOU time-of-check, time-of-use race condition #103
    Jul 10, 2019 · Event toctou: Calling function "fopen" that uses "cache_path.c_str()" after a check function. This can cause a time-of-check, time-of-use race ...Missing: detection | Show results with:detection
  38. [38]
    7. Helgrind: a thread error detector - Valgrind
    Helgrind is a Valgrind tool for detecting synchronisation errors in C, C++ and Fortran programs that use the POSIX pthreads threading primitives.Missing: TOCTOU | Show results with:TOCTOU
  39. [39]
    std::fs - Rust
    To avoid TOCTOU issues: Be aware that metadata operations (like metadata or symlink_metadata ) may be affected by changes made by other processes. Use atomic ...Create_dir · File · Create_dir_all · Read_dir
  40. [40]
    Top 11 CI/CD Security Tools For 2025 - SentinelOne
    Sep 3, 2025 · Anchore is a specialized tool for deep scanning of container images within CI/CD workflows and applies policy-based security checks to deploy ...
  41. [41]
    [PDF] A Survey of Practical Formal Methods for Security - arXiv
    Sep 3, 2021 · This survey reviews formal methods (FM) for cyber security, including theorem proving, model checking, and lightweight FM, focusing on computer ...
  42. [42]
    Formal Verification Tool TLA+: An Introduction from the Perspective ...
    Dec 20, 2021 · TLA+ is a formal verification language used for program design, modeling, and verification, especially for concurrent and distributed systems.
  43. [43]
    Restrict a Container's Access to Resources with AppArmor
    Jan 8, 2025 · This page shows you how to load AppArmor profiles on your nodes and enforce those profiles in Pods. To learn more about how Kubernetes can ...Missing: TOCTOU | Show results with:TOCTOU