CWE-366: Race Condition within a Thread
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.
Last updated
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.
Last updated
CWE-366 (Race Condition within a Thread) is a base-level software weakness catalogued by MITRE in the Common Weakness Enumeration (CWE). It describes a recurring type of mistake that can lead to exploitable security vulnerabilities.
17 recorded CVEs are caused by CWE-366 (Race Condition within a Thread). The highest-severity and most recent are shown first. 6 new CWE-366 CVEs have been recorded so far in 2026 (2 in 2025).
Mutiple vulnerabilities in the Viridian interface
ZCC race condition in ZPA tunnel handler
oznetmaster SSharpSmartThreadPool SmartThreadPool.cs race condition
RDMA/mlx4: Fix mis-use of RCU in mlx4_srq_event()
Apache Tomcat Native: Client certificate requirements can be down-graded
Kernel: gsm multiplexing race condition leads to privilege escalation
Race condition vulnerability in SAP Commerce Cloud
Outray has a Race Condition in main/apps/web/src/routes/api/$orgSlug/subdomains/index.ts
Showing 12 of 17 recorded CWE-366 CVEs. Get an alert for each new one, with AI-written analysis and fixes.
Monitor these CVEsWhat can happen when CWE-366 is exploited.
Alter Execution Logic, Unexpected State
Affects: Integrity, Other
The main problem is that -- if a lock is overcome -- data could be altered in a bad state.
Typically introduced during these phases of the software lifecycle.
Languages
Practical mitigations for CWE-366, grouped by where in the lifecycle they apply.
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.
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.
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.)
Effectiveness: High
MITRE examples of the weakness in code.
The following example demonstrates the weakness.
Vulnerable example
int foo = 0;
static int counter = 0;Vulnerable example
public classRace {
static int foo = 0;
System.out.println(foo);Real CVEs that MITRE cites as examples of this weakness.
CAPEC attack patterns that exploit this weakness.
Common questions about CWE-366.
Weakness data is sourced from the MITRE CWE catalog (v4.20). CVE associations are aggregated and kept current by RadicalNotion.AI.
Get an alert when a new CWE-366 CVE affects your products, with AI-written analysis and remediation steps.