CWEweakness

CWE-366 Race Condition within a Thread

Medium Official page ↗
Abstraction
Base
Structure
Simple
Status
Draft
Likelihood of exploit
Medium
Languages
C, C#, C++, Java
CWE version
5.0

Description

If two threads of execution use a resource simultaneously, there exists the possibility that resources may be used while invalid, in turn making the state of execution undefined.

Common consequences

• Integrity, Other: Alter Execution Logic, Unexpected State — The main problem is that -- if a lock is overcome -- data could be altered in a bad state.

Potential mitigations

• [Architecture and Design] Use locking functionality. This is the recommended solution. Implement some form of locking mechanism around code which alters or reads persistent data in a multithreaded environment. • [Architecture and Design] Create resource-locking validation checks. If no inherent locking mechanisms exist, use flags and signals to enforce your own blocking scheme when resources are being used by other threads of execution.

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.)

Observed examples

• CVE-2022-2621: Chain: two threads in a web browser use the same resource (CWE-366), but one of those threads can destroy the resource before the other has completed (CWE-416).

Related

Attack pattern · CAPEC (2)

  • CAPEC-26 Leveraging Race Conditions attack pattern
  • CAPEC-29 Leveraging Time-of-Check and Time-of-Use (TOCTOU) Race Conditions attack pattern

Observed example · CVE (1)

  • CVE-2022-2621 Use after free in Extensions in Google Chrome prior to 104.0.5112.79 allowed an attacker who convinced a user to install a malicious… vulnerability

Child of · CWE (2)

  • CWE-362 Concurrent Execution using Shared Resource with Improper Synchronization weakness
  • CWE-662 Improper Synchronization weakness

Referenced by CAPEC · weakness (2)

  • CAPEC-26 Leveraging Race Conditions attack pattern
  • CAPEC-29 Leveraging Time-of-Check and Time-of-Use (TOCTOU) Race Conditions attack pattern

Referenced by CVE · weakness (20)

  • CVE-2026-86247 Race condition within a thread vulnerability in Apache Tomcat Native allowed client certificate verification requirements to be down-graded… vulnerability
  • CVE-2026-25687 A race condition in the ZPA tunnel handler of affected versions of Zscaler Client Connector (ZCC) allows a heap corruption, resulting in a… vulnerability
  • CVE-2026-46181 In the Linux kernel, the following vulnerability has been resolved: RDMA/mlx4: Fix mis-use of RCU in mlx4_srq_event() Sashiko points out… vulnerability
  • CVE-2026-23666 Improper input validation in .NET Framework allows an unauthorized attacker to deny service over a network. vulnerability
  • CVE-2026-3904 Calling NSS-backed functions that support caching via nscd may call the nscd client side code and in the GNU C Library version 2.36 under… vulnerability
  • CVE-2026-23684 A race condition vulnerability exists in the SAP Commerce cloud. vulnerability
  • CVE-2026-22819 Outray openSource ngrok alternative. vulnerability
  • CVE-2025-58143 [This CNA information record relates to multiple CVEs; the text explains which aspects/vulnerabilities correspond to which CVE.] There are… vulnerability
  • CVE-2025-31115 XZ Utils provide a general-purpose data-compression library plus command-line tools. vulnerability
  • CVE-2024-10630 A race condition in Ivanti Application Control Engine before version 10.14.4.0 allows a local authenticated attacker to bypass the… vulnerability
  • CVE-2024-6778 Race in DevTools in Google Chrome prior to 126.0.6478.182 allowed an attacker who convinced a user to install a malicious extension to… vulnerability
  • CVE-2024-2032 A race condition vulnerability exists in zenml-io/zenml versions up to and including 0.55.3, which allows for the creation of multiple… vulnerability
  • CVE-2023-6546 A race condition was found in the GSM 0710 tty multiplexor in the Linux kernel. vulnerability
  • CVE-2023-4732 A flaw was found in pfn_swap_entry_to_page in memory management subsystem in the Linux Kernel. vulnerability
  • CVE-2023-4127 Race Condition within a Thread in GitHub repository answerdev/answer prior to v1.1.1. vulnerability
  • CVE-2023-3218 Race Condition within a Thread in GitHub repository it-novum/openitcockpit prior to 4.6.5. vulnerability
  • CVE-2015-10067 A vulnerability was found in oznetmaster SSharpSmartThreadPool. vulnerability
  • CVE-2022-1729 A race condition was found the Linux kernel in perf_event_open() which can be exploited by an unprivileged user to gain root privileges. vulnerability
  • CVE-2021-26569 Race Condition within a Thread vulnerability in iscsi_snapshot_comm_core in Synology DiskStation Manager (DSM) before 6.2.3-25426-3 allows… vulnerability
  • CVE-2020-1629 A race condition vulnerability on Juniper Network Junos OS devices may cause the routing protocol daemon (RPD) process to crash and restart… vulnerability