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

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CWE-362 (使用共享资源的并发执行不恰当同步问题(竞争条件)) — Vulnerability Class 422

422 vulnerabilities classified as CWE-362 (使用共享资源的并发执行不恰当同步问题(竞争条件)). AI Chinese analysis included.

CWE-362 represents a concurrency weakness where multiple threads access a shared resource without proper synchronization, creating a timing window for unauthorized modification. Attackers typically exploit this by manipulating execution order to trigger unpredictable behavior, such as privilege escalation or data corruption, by interleaving operations to bypass security checks or overwrite critical values. Developers mitigate this risk by implementing robust synchronization mechanisms, including mutexes, semaphores, or atomic operations, to ensure exclusive access during critical sections. Additionally, adopting thread-safe design patterns and minimizing shared state can significantly reduce the attack surface. By rigorously testing concurrent code paths and enforcing strict access controls, engineers prevent race conditions, ensuring application integrity and stability under high-concurrency scenarios.

MITRE CWE 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. A race condition occurs within concurrent environments, and it is effectively a property of a code sequence. Depending on the context, a code sequence may be in the form of a function call, a small number of instructions, a series of program invocations, etc. A race condition violates these properties, which are closely related: Exclusivity - the code sequence is given exclusive access to the shared resource, i.e., no other code sequence can modify properties of the shared resource before the original sequence has completed execution. Atomicity - the code sequence is behaviorally atomic, i.e., no other thread or process can concurrently execute the same sequence of instructions (or a subset) against the same resource. A race condition exists when an "interfering code sequence" can still access the shared resource, violating exclusivity. The interfering code sequence could be "trusted" or "untrusted." A trusted interfering code sequence occurs within the product; it cannot be modified by the attacker, and it can only be invoked indirectly. An untrusted interfering code sequence can be authored directly by the attacker, and typically it is external to the vulnerable product.
Common Consequences (4)
AvailabilityDoS: 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.
AvailabilityDoS: 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, IntegrityRead 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 ControlExecute 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.
Mitigations (5)
Architecture and DesignIn languages that support it, use synchronization primitives. Only wrap these around critical code to minimize the impact on performance.
Architecture and DesignUse thread-safe capabilities such as the data access abstraction in Spring.
Architecture and DesignMinimize 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).
ImplementationWhen using multithreading and operating on shared variables, only use thread-safe functions.
ImplementationUse 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.
Examples (2)
This code could be used in an e-commerce application that supports transfers between accounts. It takes the total amount of the transfer, sends it to the new account, and deducts the amount from the original account.
$transfer_amount = GetTransferAmount(); $balance = GetBalanceFromDatabase(); if ($transfer_amount < 0) { FatalError("Bad Transfer Amount"); } $newbalance = $balance - $transfer_amount; if (($balance - $transfer_amount) < 0) { FatalError("Insufficient Funds"); } SendNewBalanceToDatabase($newbalance); NotifyUser("Transfer of $transfer_amount succeeded."); NotifyUser("New balance: $newbalance");
Bad · Perl
In the following pseudocode, the attacker makes two simultaneous calls of the program, CALLER-1 and CALLER-2. Both callers are for the same user account. CALLER-1 (the attacker) is associated with PROGRAM-1 (the instance that handles CALLER-1). CALLER-2 is associated with PROGRAM-2. CALLER-1 makes a transfer request of 80.00. PROGRAM-1 calls GetBalanceFromDatabase and sets $balance to 100.00 PROGRAM-1 calculates $newbalance as 20.00, then calls SendNewBalanceToDatabase(). Due to high server load, the PROGRAM-1 call to SendNewBalanceToDatabase() encounters a delay. CALLER-2 makes a transfer req
Attack · Other
The following function attempts to acquire a lock in order to perform operations on a shared resource.
void f(pthread_mutex_t *mutex) { pthread_mutex_lock(mutex); /* access shared resource */ pthread_mutex_unlock(mutex); }
Bad · C
int f(pthread_mutex_t *mutex) { int result; result = pthread_mutex_lock(mutex); if (0 != result) return result; /* access shared resource */ return pthread_mutex_unlock(mutex); }
Good · C
CVE IDTitleCVSSSeverityPublished
CVE-2021-0247 Junos OS: PTX Series, QFX Series: Due to a race condition input loopback firewall filters applied to interfaces may not operate even when listed in the running configuration. — Junos OS 5.1 Medium2021-04-22
CVE-2021-23133 Linux Kernel sctp_destroy_sock race condition — Linux Kernel 6.7 Medium2021-04-22
CVE-2021-20261 Linux kernel 竞争条件问题漏洞 — kernel 7.0 -2021-03-11
CVE-2020-27837 GNOME Display Manager 竞争条件问题漏洞 — gdm 5.7 -2020-12-28
CVE-2020-27825 Linux kernel 资源管理错误漏洞 — kernel 5.7 -2020-12-11
CVE-2020-16123 Bypass of snapd pulseaudio restrictions — pulseaudio 4.4 Medium2020-12-03
CVE-2020-25653 SPICE vdagent 竞争条件问题漏洞 — spice-vdagent 6.3 -2020-11-26
CVE-2020-25651 SPICE vdagent 竞争条件问题漏洞 — spice-vdagent 7.5 -2020-11-26
CVE-2020-1667 Junos OS: MX Series: Services card might restart due to a race condition when DNS filtering is enabled. — Junos OS 8.3 High2020-10-16
CVE-2020-15707 GRUB2 contained integer overflows when handling the initrd command, leading to a heap-based buffer overflow. — grub2 in Ubuntu 5.7 Medium2020-07-29
CVE-2020-15706 GRUB2 contains a race condition leading to a use-after-free vulnerability which can be triggered by redefining a function whilst the same function is already executing. — grub2 in Ubuntu 6.4 Medium2020-07-29
CVE-2020-1645 Junos OS: MX Series: Services card might restart when DNS filtering is enabled — Junos OS 8.3 High2020-07-17
CVE-2020-1641 Junos OS: A race condition on receipt of crafted LLDP packets leads to a memory leak and an LLDP crash. — Junos OS 6.5 Medium2020-07-17
CVE-2020-3350 Cisco AMP for Endpoints and ClamAV Privilege Escalation Vulnerability — Cisco AMP for Endpoints 5.5 Medium2020-06-18
CVE-2020-3353 Cisco Identity Services Engine Denial of Service Vulnerability — Cisco Identity Services Engine Software 5.9 Medium2020-06-03
CVE-2020-10737 oddjob 竞争条件问题漏洞 — oddjob 6.3 Medium2020-05-27
CVE-2019-14898 Linux kernel 竞争条件问题漏洞 — kernel 7.0 -2020-05-08
CVE-2012-0953 Kernel heap contents leak race in ioctl handler — graphics drivers 5.0 Medium2020-05-08
CVE-2020-3163 Cisco Unified Contact Center Enterprise Denial of Service Vulnerability — Cisco Unified Contact Center Enterprise 5.9 -2020-02-19
CVE-2019-18567 Bromium client - out of bound read results in race condition causing Kernel memory leaks or denial of service — Bromium client 6.7 -2020-02-03
CVE-2019-3016 Linux KVM 竞争条件问题漏洞 — linux_kernel 6.2 Medium2020-01-31
CVE-2019-7614 Elasticsearch 竞争条件问题漏洞 — Elasticsearch 5.9 -2019-07-30
CVE-2019-3837 Linux kernel 竞争条件问题漏洞 — kernel 7.1 -2019-04-11
CVE-2018-17244 Elasticsearch Security 安全漏洞 — Elasticsearch 7.5 -2018-12-20
CVE-2018-16867 QEMU 安全漏洞 — QEMU: 8.0 -2018-12-12
CVE-2018-0480 Cisco IOS XE Software Errdisable Denial of Service Vulnerability — Cisco IOS XE Software 6.1 -2018-10-05
CVE-2017-7543 openstack-neutron 竞争条件漏洞 — openstack-neutron 5.9 -2018-07-26
CVE-2018-10850 Red Hat 389-ds-base 竞争条件漏洞 — 389-ds-base 5.9 -2018-06-13
CVE-2018-3759 private_address_check ruby gem 竞争条件漏洞 — private_address_check ruby gem 5.9 -2018-06-13
CVE-2017-2619 Samba 后置链接漏洞 — samba 7.1 -2018-03-12

Vulnerabilities classified as CWE-362 (使用共享资源的并发执行不恰当同步问题(竞争条件)) represent 422 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.