CWEweakness

CWE-362 Concurrent Execution using Shared Resource with Improper Synchronization

Medium Official page ↗
Alternate terms
Race Condition
Abstraction
Class
Structure
Simple
Status
Draft
Likelihood of exploit
Medium
Languages
C, C++, Java, Python
CWE version
5.0

Description

The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.

Common consequences

• Availability: DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory), DoS: Resource Consumption (Other) — When a race condition makes it possible to bypass a resource cleanup routine or trigger multiple initialization routines, it may lead to resource exhaustion. • Availability: DoS: Crash, Exit, or Restart, DoS: Instability — When a race condition allows multiple control flows to access a resource simultaneously, it might lead the product(s) into unexpected states, possibly resulting in a crash. • Confidentiality, Integrity: Read Files or Directories, Read Application Data — When a race condition is combined with predictable resource names and loose permissions, it may be possible for an attacker to overwrite or access confidential data (CWE-59). • Access Control: Execute Unauthorized Code or Commands, Gain Privileges or Assume Identity, Bypass Protection Mechanism — This can have security implications when the expected synchronization is in security-critical code, such as recording whether a user is authenticated or modifying important state information that should not be influenced by an outsider.

Potential mitigations

• [Architecture and Design] In languages that support it, use synchronization primitives. Only wrap these around critical code to minimize the impact on performance. • [Architecture and Design] Use thread-safe capabilities such as the data access abstraction in Spring. • [Architecture and Design] Minimize the usage of shared resources in order to remove as much complexity as possible from the control flow and to reduce the likelihood of unexpected conditions occurring. Additionally, this will minimize the amount of synchronization necessary and may even help to reduce the likelihood of a denial of service where an attacker may be able to repeatedly trigger a critical section (CWE-400). • [Implementation] When using multithreading and operating on shared variables, only use thread-safe functions. • [Implementation] Use atomic operations on shared variables. Be wary of innocent-looking constructs such as "x++". This may appear atomic at the code layer, but it is actually non-atomic at the instruction layer, since it involves a read, followed by a computation, followed by a write. • [Implementation] Use a mutex if available, but be sure to avoid related weaknesses such as CWE-412. • [Implementation] Avoid double-checked locking (CWE-609) and other implementation errors that arise when trying to avoid the overhead of synchronization. • [Implementation] Disable interrupts or signals over critical parts of the code, but also make sure that the code does not go into a large or infinite loop. • [Implementation] Use the volatile type modifier for critical variables to avoid unexpected compiler optimization or reordering. This does not necessarily solve the synchronization problem, but it can help. • [Architecture and Design, Operation] Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.

Detection methods

• Black Box: Black box methods may be able to identify evidence of race conditions via methods such as multiple simultaneous connections, which may cause the software to become instable or crash. However, race conditions with very narrow timing windows would not be detectable. • White Box: Common idioms are detectable in white box analysis, such as time-of-check-time-of-use (TOCTOU) file operations (CWE-367), or double-checked locking (CWE-609). • Automated Dynamic Analysis: This weakness can be detected using dynamic tools and techniques that interact with the software using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The software's operation may slow down, but it should not become unstable, crash, or generate incorrect results. Race conditions may be detected with a stress-test by calling the software simultaneously from a large number of threads or processes, and look for evidence of any unexpected behavior. Insert breakpoints or delays in between relevant code statements to artificially expand the race window so that it will be easier to detect. • Automated Static Analysis - Binary or Bytecode: According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: • Bytecode Weakness Analysis - including disassembler + source code weakness analysis Cost effective for partial coverage: • Binary Weakness Analysis - including disassembler + source code weakness analysis • Dynamic Analysis with Automated Results Interpretation: According to SOAR [REF-1479], the following detection techniques may be useful: Cost effective for partial coverage: • Web Application Scanner • Web Services Scanner • Database Scanners • Dynamic Analysis with Manual Results Interpretation: According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: • Framework-based Fuzzer Cost effective for partial coverage: • Fuzz Tester • Monitored Virtual Environment - run potentially malicious code in sandbox / wrapper / virtual machine, see if it does anything suspicious • Manual Static Analysis - Source Code: According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: • Manual Source Code Review (not inspections) Cost effective for partial coverage: • Focused Manual Spotcheck - Focused manual analysis of source • Automated Static Analysis - Source Code: According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: • Source code Weakness Analyzer • Context-configured Source Code Weakness Analyzer • Architecture or Design Review: According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: • Formal Methods / Correct-By-Construction Cost effective for partial coverage: • Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)

Observed examples

• CVE-2024-38106: OS kernel stores sensitive data in improperly locked memory, allowing local users to gain privileges by winning a race condition • CVE-2022-29527: Go application for cloud management creates a world-writable sudoers file that allows local attackers to inject sudo rules and escalate privileges to root by winning a race condition. • CVE-2021-1782: Chain: improper locking (CWE-667) leads to race condition (CWE-362), as exploited in the wild per CISA KEV. • CVE-2021-0920: Chain: mobile platform race condition (CWE-362) leading to use-after-free (CWE-416), as exploited in the wild per CISA KEV. • CVE-2020-6819: Chain: race condition (CWE-362) leads to use-after-free (CWE-416), as exploited in the wild per CISA KEV. • CVE-2019-18827: Chain: JTAG interface is not disabled (CWE-1191) during ROM code execution, introducing a race condition (CWE-362) to extract encryption keys • CVE-2019-1161: Chain: race condition (CWE-362) in anti-malware product allows deletion of files by creating a junction (CWE-1386) and using hard links during the time window in which a temporary file is created and deleted. • CVE-2015-1743: TOCTOU in sandbox process allows installation of untrusted browser add-ons by replacing a file after it has been verified, but before it is executed • CVE-2014-8273: Chain: chipset has a race condition (CWE-362) between when an interrupt handler detects an attempt to write-enable the BIOS (in violation of the lock bit), and when the handler resets the write-enable bit back to 0, allowing attackers to issue BIOS writes during the timing window [REF-1237]. • CVE-2008-5044: Race condition leading to a crash by calling a hook removal procedure while other activities are occurring at the same time. • CVE-2008-2958: Chain: time-of-check time-of-use (TOCTOU) race condition in program allows bypass of protection mechanism that was designed to prevent symlink attacks. • CVE-2008-1570: Chain: time-of-check time-of-use (TOCTOU) race condition in program allows bypass of protection mechanism that was designed to prevent symlink attacks. • CVE-2008-0058: Unsynchronized caching operation enables a race condition that causes messages to be sent to a deallocated object. • CVE-2008-0379: Race condition during initialization triggers a buffer overflow. • CVE-2007-6599: Daemon crash by quickly performing operations and undoing them, which eventually leads to an operation that does not acquire a lock. • CVE-2007-6180: Chain: race condition triggers NULL pointer dereference • CVE-2007-5794: Race condition in library function could cause data to be sent to the wrong process. • CVE-2007-3970: Race condition in file parser leads to heap corruption. • CVE-2008-5021: Composite: race condition (CWE-362) allows attacker to modify an object while it is still being initialized, causing software to access uninitialized memory (CWE-908). • CVE-2009-4895: Chain: race condition for an argument value, possibly resulting in NULL dereference • CVE-2009-3547: Chain: race condition (CWE-362) might allow resource to be released before operating on it, leading to NULL dereference (CWE-476) • CVE-2006-5051: Chain: Signal handler contains too much functionality (CWE-828), introducing a race condition (CWE-362) that leads to a double free (CWE-415).

Related

Observed example · not in database (1)

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 (21)

  • CVE-2024-38106 Windows Kernel Elevation of Privilege Vulnerability vulnerability
  • CVE-2022-29527 Amazon AWS amazon-ssm-agent before 3.1.1208.0 creates a world-writable sudoers file, which allows local attackers to inject Sudo rules and… vulnerability
  • CVE-2021-0920 In unix_scm_to_skb of af_unix.c, there is a possible use after free bug due to a race condition. vulnerability
  • CVE-2021-1782 A race condition was addressed with improved locking. vulnerability
  • CVE-2020-6819 Under certain conditions, when running the nsDocShell destructor, a race condition can cause a use-after-free. vulnerability
  • CVE-2019-18827 On Barco ClickShare Button R9861500D01 devices (before firmware version 1.9.0) JTAG access is disabled after ROM code execution. vulnerability
  • CVE-2019-1161 An elevation of privilege vulnerability exists when the MpSigStub.exe for Defender allows file deletion in arbitrary locations. vulnerability
  • CVE-2015-1743 Microsoft Internet Explorer 7 through 11 allows remote attackers to gain privileges via a crafted web site, aka "Internet Explorer… vulnerability
  • CVE-2009-4895 Race condition in the tty_fasync function in drivers/char/tty_io.c in the Linux kernel before 2.6.32.6 allows local users to cause a denial… vulnerability
  • CVE-2009-3547 Multiple race conditions in fs/pipe.c in the Linux kernel before 2.6.32-rc6 allow local users to cause a denial of service (NULL pointer… vulnerability
  • CVE-2008-5021 nsFrameManager in Firefox 3.x before 3.0.4, Firefox 2.x before 2.0.0.18, Thunderbird 2.x before 2.0.0.18, and SeaMonkey 1.x before 1.1.13… vulnerability
  • CVE-2008-5044 Race condition in Microsoft Windows Server 2003 and Vista allows local users to cause a denial of service (crash or hang) via a… vulnerability
  • CVE-2008-2958 Race condition in (1) checkinstall 1.6.1 and (2) installwatch allows local users to overwrite arbitrary files and have other impacts via… vulnerability
  • CVE-2008-1570 Race condition in the create_lockpath function in policyd-weight 0.1.14 beta-16 allows local users to modify or delete arbitrary files by… vulnerability
  • CVE-2008-0058 Race condition in the NSURLConnection cache management functionality in Foundation for Apple Mac OS X 10.4.11 allows remote attackers to… vulnerability
  • CVE-2008-0379 Race condition in the Enterprise Tree ActiveX control (EnterpriseControls.dll 11.5.0.313) in Crystal Reports XI Release 2 allows remote… vulnerability
  • CVE-2007-6599 Race condition in fileserver in OpenAFS 1.3.50 through 1.4.5 and 1.5.0 through 1.5.27 allows remote attackers to cause a denial of service… vulnerability
  • CVE-2007-6180 Race condition in the Remote Procedure Call kernel module (rpcmod) in Sun Solaris 8 through 10 allows local users to cause a denial of… vulnerability
  • CVE-2007-5794 Race condition in nss_ldap, when used in applications that are linked against the pthread library and fork after a call to nss_ldap, might… vulnerability
  • CVE-2007-3970 Race condition in ESET NOD32 Antivirus before 2.2289 allows remote attackers to execute arbitrary code via a crafted CAB file, which… vulnerability
  • CVE-2006-5051 Signal handler race condition in OpenSSH before 4.4 allows remote attackers to cause a denial of service (crash), and possibly execute… vulnerability

Can precede · CWE (2)

  • CWE-416 Use After Free weakness
  • CWE-476 NULL Pointer Dereference weakness

Child of · CWE (1)

  • 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 (2,975)

  • CVE-2026-118030 A flaw was found in the HOTP authentication mechanism of the keycloak-services component, which provides identity and access management… vulnerability
  • CVE-2026-115402 OpenVPN ovpn-dco-win 0.6.5 through 2.8.13 allows unprivileged local users to cause a denial of service (system crash) via a race condition… vulnerability
  • CVE-2026-117499 @fastify/session is a session plugin for Fastify. vulnerability
  • CVE-2026-117507 A security vulnerability has been detected in a2aproject a2a-java up to 1.2.0.Final. vulnerability
  • CVE-2026-118128 A vulnerability has been found in a2aproject a2a-js up to 1.1.0. vulnerability
  • CVE-2026-111404 Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') vulnerability in VillaTheme Photo Reviews for… vulnerability
  • CVE-2026-112556 A race condition was addressed with additional validation. vulnerability
  • CVE-2026-112708 A race condition was addressed with improved locking. vulnerability
  • CVE-2026-116119 A vulnerability was found in NocoDB up to 2026.08.0. vulnerability
  • CVE-2026-116121 A vulnerability was identified in NocoDB up to 2026.08.0. vulnerability
  • CVE-2026-116215 MacCMS v10 through 2026.1000.4056 contains a race condition vulnerability in Card::useData() that allows authenticated members to redeem… vulnerability
  • CVE-2026-116263 A flaw has been found in HaschekSolutions PictShare up to 3.7.1. vulnerability
  • CVE-2026-116403 Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') vulnerability in Awesomemotive Easy Digital… vulnerability
  • CVE-2026-116476 A weakness has been identified in a2aproject a2a-dotnet up to 1.0.0-preview3. vulnerability
  • CVE-2026-82390 The Espressif AES driver drivers/crypto/crypto_esp32_aes.c advertises a multi-session cipher API — it hands out up to… vulnerability
  • CVE-2026-115567 Tokio is a runtime for writing applications with Rust. vulnerability
  • CVE-2026-114641 Traefik 2.11.x before 2.11.58 and 3.x before 3.7.14 contains a race condition in NTLM and Kerberos (Negotiate) backend authentication,… vulnerability
  • CVE-2026-113707 A security flaw has been discovered in a2aproject a2a-rs up to 0.4.4. vulnerability
  • CVE-2026-78117 The Infineon PSOC 6 BLESS HCI driver in drivers/bluetooth/hci/hci_infineon_psoc6_bless.c stored the outgoing HCI packet descriptor in a… vulnerability
  • CVE-2026-78118 The kernel helper z_waitq_head() (kernel/include/wait_q.h) reads the head of a thread wait queue, but on SMP systems it was called from… vulnerability
  • CVE-2026-82942 A data race in the RDMA transport of Apache bRPC (versions < 1.18.0) allows a remote client to crash the server process (denial of service)… vulnerability
  • CVE-2026-94300 Replaying GSS-TSIG signed UDP messages can result in memory corruption in "`named`". vulnerability
  • CVE-2026-101356 Incorrect object recycling and re-use vulnerability in Apache Tomcat affecting HTTP/2 processing of asynchronous servlets can trigger… vulnerability
  • CVE-2026-112906 filelock is a platform-independent file lock for Python. vulnerability
  • CVE-2026-65372 A race condition was addressed with additional validation. vulnerability
  • CVE-2026-86915 A race condition was addressed with improved locking. vulnerability
  • CVE-2026-86961 A race condition was addressed with additional validation. vulnerability
  • CVE-2026-19178 IBM Storage TS4500 Library 1.1.1.6 through 1.12.0.3 could allow a remote authenticated attacker to gain unauthorized administrative… vulnerability
  • CVE-2026-85248 Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') vulnerability in Apache Camel PQC component. vulnerability
  • CVE-2026-111449 Wheels 3.0.0 through 4.1.1 can disclose detailed exceptions when allowIPBasedDebugAccess=true (disabled by default). vulnerability
Show all 2,975 ›

Referenced by CWE · can precede (1)

  • CWE-662 Improper Synchronization weakness

Referenced by CWE · child of (8)

  • CWE-1223 Race Condition for Write-Once Attributes weakness
  • CWE-1298 Hardware Logic Contains Race Conditions weakness
  • CWE-364 Signal Handler Race Condition weakness
  • CWE-366 Race Condition within a Thread weakness
  • CWE-367 Time-of-check Time-of-use (TOCTOU) Race Condition weakness
  • CWE-368 Context Switching Race Condition weakness
  • CWE-421 Race Condition During Access to Alternate Channel weakness
  • CWE-689 Permission Race Condition During Resource Copy weakness

Referenced by CWE · has member (4)

  • CWE-1003 Weaknesses for Simplified Mapping of Published Vulnerabilities view
  • CWE-1387 Weaknesses in the 2022 CWE Top 25 Most Dangerous Software Weaknesses view
  • CWE-1425 Weaknesses in the 2023 CWE Top 25 Most Dangerous Software Weaknesses view
  • CWE-635 Weaknesses Originally Used by NVD from 2008 to 2016 view

Referenced by CWE · requires (2)

  • CWE-61 UNIX Symbolic Link (Symlink) Following weakness
  • CWE-689 Permission Race Condition During Resource Copy weakness

Referenced by OWASP · mapped cwe (1)