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-2021-1567 Cisco AnyConnect Secure Mobility Client for Windows with VPN Posture (HostScan) Module DLL Hijacking Vulnerability — Cisco AnyConnect Secure Mobility Client 7.0 High2021-06-16
CVE-2021-20181 QEMU 竞争条件问题漏洞 — qemu 6.6 -2021-05-13
CVE-2021-31427 Corel Parallels Desktop 安全漏洞 — Desktop 6.5 -2021-04-29
CVE-2021-31422 Corel Parallels Desktop 安全漏洞 — Desktop 6.7 -2021-04-29
CVE-2020-25860 Pengutronix RAUC 安全漏洞 — Pengutronix RAUC 6.6 -2020-12-21
CVE-2020-27252 Medtronic MyCareLink Smart Time-of-check Time-of-use Race Condition — Smart Model 25000 Patient Reader 8.8 High2020-12-14
CVE-2020-12926 Trusted Platform Modules 访问控制错误漏洞 — AMD's fTPM implementation 6.4 -2020-11-12
CVE-2020-8354 Lenovo 安全漏洞 — BIOS 6.4 Medium2020-11-11
CVE-2020-24428 Acrobat Reader DC for macOS Race Condition Vulnerability Could Lead to Privilege Escalation — Acrobat Reader 7.7 High2020-11-05
CVE-2020-8332 IBM System x servers 安全漏洞 — System x 6.4 Medium2020-10-14
CVE-2020-14375 Ubuntu DPDK 代码问题漏洞 — dpdk 7.8 -2020-09-30
CVE-2020-8342 Lenovo System Update 安全漏洞 — System Update 7.3 High2020-09-15
CVE-2020-15702 TOCTOU in apport — apport 7.0 High2020-08-06
CVE-2020-2032 GlobalProtect App: File race condition vulnerability leads to local privilege escalation during upgrade — GlobalProtect App 7.0 High2020-06-10
CVE-2020-8833 Apport race condition in crash report permissions — Apport 5.6 Medium2020-04-22
CVE-2020-8867 OPC Foundation UA .NET Standard 代码问题漏洞 — UA .NET Standard 5.9 -2020-04-22
CVE-2020-8017 race condition on texlive-filesystem cron job allows for the deletion of unintended files — SUSE Linux Enterprise Module for Desktop Applications 15-SP1 6.2 Medium2020-04-02
CVE-2020-8016 race condition in the packaging of texlive-filesysten — SUSE Linux Enterprise Module for Desktop Applications 15-SP1 4.9 Medium2020-04-02
CVE-2020-8873 Corel Parallels Desktop xHCI组件竞争条件问题漏洞 — Desktop 8.2 -2020-03-23
CVE-2019-11774 Eclipse OMR 竞争条件问题漏洞 — Eclipse OMR 7.4 -2019-09-12
CVE-2019-7307 Apport contains a TOCTTOU vulnerability when reading the users ~/.apport-ignore.xml — apport 7.0 -2019-08-29
CVE-2019-11775 Eclipse OpenJ9 竞争条件问题漏洞 — Eclipse OpenJ9 7.4 -2019-07-30
CVE-2019-5421 Plataformatec Devise 安全特征问题漏洞 — Devise ruby gem 9.1 -2019-04-03
CVE-2018-16872 QEMU 安全漏洞 — QEMU: 8.1 -2018-12-13
CVE-2018-1121 procps/procps-ng 安全漏洞 — procps-ng, procps 5.9 -2018-06-13

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