Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CWE-367 (检查时间与使用时间(TOCTOU)的竞争条件) — Vulnerability Class 325

325 vulnerabilities classified as CWE-367 (检查时间与使用时间(TOCTOU)的竞争条件). AI Chinese analysis included.

CWE-367 represents a logic flaw where a system verifies a resource’s state before accessing it, allowing the state to change maliciously between the verification and actual usage. Attackers typically exploit this race condition by manipulating the resource, such as swapping a file or altering permissions, during the narrow window between the check and the use. This enables unauthorized access or privilege escalation, as the application proceeds based on outdated, validated assumptions. To mitigate this vulnerability, developers must ensure atomic operations, ensuring that the check and use occur simultaneously without interruption. Implementing robust locking mechanisms, utilizing secure system calls that combine verification and access, or adopting file descriptor-based approaches can effectively prevent state changes, thereby eliminating the race condition and securing the resource against temporal manipulation.

MITRE CWE Description
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.
Common Consequences (6)
Integrity, OtherAlter Execution Logic, Unexpected State
The attacker can gain access to otherwise unauthorized resources.
Integrity, OtherModify Application Data, Modify Files or Directories, Modify Memory, Other
Race conditions such as this kind may be employed to gain read or write access to resources which are not normally readable or writable by the user in question.
Integrity, OtherOther
The resource in question, or other resources (through the corrupted one), may be changed in undesirable ways by a malicious user.
Non-RepudiationHide Activities
If a file or other resource is written in this method, as opposed to in a valid way, logging of the activity may not occur.
Non-Repudiation, OtherOther
In some cases it may be possible to delete files a malicious user might not otherwise have access to, such as log files.
Mitigations (5)
ImplementationThe most basic advice for TOCTOU vulnerabilities is to not perform a check before the use. This does not resolve the underlying issue of the execution of a function on a resource whose state and identity cannot be assured, but it does help to limit the false sense of security given by the check.
ImplementationWhen the file being altered is owned by the current user and group, set the effective gid and uid to that of the current user and group when executing this statement.
Architecture and DesignLimit the interleaving of operations on files from multiple processes.
Implementation, Architecture and DesignIf you cannot perform operations atomically and you must share access to the resource between multiple processes or threads, then try to limit the amount of time (CPU cycles) between the check and use of the resource. This will not fix the problem, but it could make it more difficult for an attack to succeed.
ImplementationRecheck the resource after the use call to verify that the action was taken appropriately.
Examples (2)
The following code checks a file, then updates its contents.
struct stat *sb; ... lstat("...",sb); // it has not been updated since the last time it was read printf("stated file\n"); if (sb->st_mtimespec==...){ print("Now updating things\n"); updateThings(); }
Bad · C
The following code is from a program installed setuid root. The program performs certain file operations on behalf of non-privileged users, and uses access checks to ensure that it does not use its root privileges to perform operations that should otherwise be unavailable the current user. The program uses the access() system call to check if the person running the program has permission to access…
if(!access(file,W_OK)) { f = fopen(file,"w+"); operate(f); ... } else { fprintf(stderr,"Unable to open file %s.\n",file); }
Bad · C
CVE IDTitleCVSSSeverityPublished
CVE-2022-45842 WordPress WP ULike Plugin <= 4.6.4 is vulnerable to Race Condition vulnerability — WP ULike (WordPress plugin) 5.3 Medium2022-11-30
CVE-2022-22220 Junos OS and Junos OS Evolved: Due to a race condition the rpd process can crash upon receipt of a BGP update message containing flow spec route — Junos OS 5.9 Medium2022-10-18
CVE-2022-29800 networkd-dispatcher 安全漏洞 — networkd-dispatcher 4.7 -2022-09-21
CVE-2022-26859 Dell BIOS 安全漏洞 — CPG BIOS 6.1 Medium2022-09-06
CVE-2022-20909 Cisco Nexus Dashboard Privilege Escalation Vulnerabilities — Cisco Nexus Dashboard 6.0 Medium2022-07-21
CVE-2022-20906 Cisco Nexus Dashboard Privilege Escalation Vulnerabilities — Cisco Nexus Dashboard 6.0 Medium2022-07-21
CVE-2022-20907 Cisco Nexus Dashboard Privilege Escalation Vulnerabilities — Cisco Nexus Dashboard 6.0 Medium2022-07-21
CVE-2022-20908 Cisco Nexus Dashboard Privilege Escalation Vulnerabilities — Cisco Nexus Dashboard 6.0 Medium2022-07-21
CVE-2022-34899 Parallels Access 安全漏洞 — Access 7.8 -2022-07-18
CVE-2021-34986 Corel Parallels Desktop 安全漏洞 — Desktop 7.8 -2022-07-15
CVE-2022-33691 SAMSUNG Mobile devices score driver 安全漏洞 — Samsung Mobile Devices 6.2 Medium2022-07-11
CVE-2021-3969 Lenovo Vantage 安全漏洞 — IMController 7.8 High2022-05-18
CVE-2021-3922 Lenovo Vantage 竞争条件问题漏洞 — IMController 7.8 High2022-05-18
CVE-2022-1537 file.copy operations in GruntJS are vulnerable to a TOCTOU race condition leading to arbitrary file write in gruntjs/grunt — gruntjs/grunt 7.0 -2022-05-10
CVE-2022-0915 Logitech Sync desktop application prior to 2.4.574 - TOCTOU during installation leads to privelege escalation — Sync 6.0 Medium2022-04-12
CVE-2022-24413 Dell Technologies Dell PowerScale OneFS 安全漏洞 — PowerScale OneFS 4.4 Medium2022-04-12
CVE-2022-27834 Samsung SMR资源管理错误漏洞 — Samsung Mobile Devices 2.9 Low2022-04-11
CVE-2022-0280 McAfee Total Protection (MTP) - File Deletion vulnerability — McAfee Total Protection for Windows 7.5 High2022-03-10
CVE-2022-23653 B2 Command Line Tool TOCTOU application key disclosure — B2_Command_Line_Tool 4.7 Medium2022-02-23
CVE-2022-23651 b2-sdk-python TOCTOU application key disclosure — b2-sdk-python 4.7 Medium2022-02-23
CVE-2022-23563 Insecure temporary file in Tensorflow — tensorflow 7.1 High2022-02-04
CVE-2020-8562 Bypass of Kubernetes API Server proxy TOCTOU — Kubernetes 2.2 Low2022-02-01
CVE-2022-23181 Local privilege escalation with FileStore — Apache Tomcat 7.0 -2022-01-27
CVE-2022-23029 F5 BIG-IP 安全漏洞 — BIG-IP 5.3 -2022-01-25
CVE-2021-4001 Linux kernel 安全漏洞 — kernel 4.1 -2022-01-21
CVE-2011-4126 Calibre 授权问题漏洞 — Calibre 8.1 -2021-10-27
CVE-2021-34788 Cisco AnyConnect Secure Mobility Client for Linux and Mac OS with VPN Posture (HostScan) Module Shared Library Hijacking Vulnerability — Cisco AnyConnect Secure Mobility Client 7.0 High2021-10-06
CVE-2021-3054 PAN-OS: Unsigned Code Execution During Plugin Installation Race Condition Vulnerability — PAN-OS 7.2 High2021-09-08
CVE-2021-0289 Junos OS: User-defined ARP Policer isn't applied on Aggregated Ethernet (AE) interface until firewall process is restarted — Junos OS 6.5 Medium2021-07-15
CVE-2021-32708 Time-of-check Time-of-use (TOCTOU) Race Condition in league/flysystem — flysystem 9.8 Critical2021-06-24

Vulnerabilities classified as CWE-367 (检查时间与使用时间(TOCTOU)的竞争条件) represent 325 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.