|
Weakness ID: 662
Vulnerability Mapping:
DISCOURAGED
This CWE ID should not be used to map to real-world vulnerabilities
Abstraction: Class Class - a weakness that is described in a very abstract fashion, typically independent of any specific language or technology. More specific than a Pillar Weakness, but more general than a Base Weakness. Class level weaknesses typically describe issues in terms of 1 or 2 of the following dimensions: behavior, property, and resource. |
Synchronization refers to a variety of behaviors and mechanisms that allow two or more independently-operating processes or threads to ensure that they operate on shared resources in predictable ways that do not interfere with each other. Some shared resource operations cannot be executed atomically; that is, multiple steps must be guaranteed to execute sequentially, without any interference by other processes. Synchronization mechanisms vary widely, but they may include locking, mutexes, and semaphores. When a multi-step operation on a shared resource cannot be guaranteed to execute independent of interference, then the resulting behavior can be unpredictable. Improper synchronization could lead to data or memory corruption, denial of service, etc.
This table specifies different individual consequences
associated with the weakness. The Scope identifies the application security area that is
violated, while the Impact describes the negative technical impact that arises if an
adversary succeeds in exploiting this weakness. The Likelihood provides information about
how likely the specific consequence is expected to be seen relative to the other
consequences in the list. For example, there may be high likelihood that a weakness will be
exploited to achieve a certain impact, but a low likelihood that it will be exploited to
achieve a different impact.
| Impact | Details |
|---|---|
|
Modify Application Data; Read Application Data; Alter Execution Logic |
Scope: Integrity, Confidentiality, Other |
| Phase(s) | Mitigation |
|---|---|
|
Implementation |
Use industry standard APIs to synchronize your code.
|
This table shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOf and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition,
relationships such as PeerOf and CanAlsoBe are defined to show similar weaknesses that the user
may want to explore.
Relevant to the view "Research Concepts" (View-1000)
| Nature | Type | ID | Name |
|---|---|---|---|
| ChildOf |
|
664 | Improper Control of a Resource Through its Lifetime |
| ChildOf |
|
691 | Insufficient Control Flow Management |
| ParentOf |
|
362 | Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') |
| ParentOf |
|
663 | Use of a Non-reentrant Function in a Concurrent Context |
| ParentOf |
|
667 | Improper Locking |
| ParentOf |
|
820 | Missing Synchronization |
| ParentOf |
|
821 | Incorrect Synchronization |
| ParentOf |
|
1058 | Invokable Control Element in Multi-Thread Context with non-Final Static Storable or Member Element |
| ParentOf |
|
1265 | Unintended Reentrant Invocation of Non-reentrant Code Via Nested Calls |
| CanPrecede |
|
362 | Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') |
Relevant to the view "Weaknesses for Simplified Mapping of Published Vulnerabilities" (View-1003)
| Nature | Type | ID | Name |
|---|---|---|---|
| MemberOf |
|
1003 | Weaknesses for Simplified Mapping of Published Vulnerabilities |
| ParentOf |
|
667 | Improper Locking |
Relevant to the view "CISQ Quality Measures (2020)" (View-1305)
| Nature | Type | ID | Name |
|---|---|---|---|
| ParentOf |
|
366 | Race Condition within a Thread |
| ParentOf |
|
543 | Use of Singleton Pattern Without Synchronization in a Multithreaded Context |
| ParentOf |
|
567 | Unsynchronized Access to Shared Data in a Multithreaded Context |
| ParentOf |
|
667 | Improper Locking |
| ParentOf |
|
764 | Multiple Locks of a Critical Resource |
| ParentOf |
|
820 | Missing Synchronization |
| ParentOf |
|
821 | Incorrect Synchronization |
| ParentOf |
|
833 | Deadlock |
| ParentOf |
|
1058 | Invokable Control Element in Multi-Thread Context with non-Final Static Storable or Member Element |
| ParentOf |
|
1096 | Singleton Class Instance Creation without Proper Locking or Synchronization |
Relevant to the view "CISQ Data Protection Measures" (View-1340)
| Nature | Type | ID | Name |
|---|---|---|---|
| ParentOf |
|
366 | Race Condition within a Thread |
| ParentOf |
|
543 | Use of Singleton Pattern Without Synchronization in a Multithreaded Context |
| ParentOf |
|
567 | Unsynchronized Access to Shared Data in a Multithreaded Context |
| ParentOf |
|
667 | Improper Locking |
| ParentOf |
|
764 | Multiple Locks of a Critical Resource |
| ParentOf |
|
820 | Missing Synchronization |
| ParentOf |
|
821 | Incorrect Synchronization |
| ParentOf |
|
1058 | Invokable Control Element in Multi-Thread Context with non-Final Static Storable or Member Element |
| ParentOf |
|
1096 | Singleton Class Instance Creation without Proper Locking or Synchronization |
The different Modes of Introduction provide information
about how and when this
weakness may be introduced. The Phase identifies a point in the life cycle at which
introduction
may occur, while the Note provides a typical scenario related to introduction during the
given
phase.
| Phase | Note |
|---|---|
| Architecture and Design | |
| Implementation |
This listing shows possible areas for which the given
weakness could appear. These
may be for specific named Languages, Operating Systems, Architectures, Paradigms,
Technologies,
or a class of such platforms. The platform is listed along with how frequently the given
weakness appears for that instance.
| Languages |
Class: Not Language-Specific (Undetermined Prevalence) |
Example 1
The following function attempts to acquire a lock in order to perform operations on a shared resource.
However, the code does not check the value returned by pthread_mutex_lock() for errors. If pthread_mutex_lock() cannot acquire the mutex for any reason, the function may introduce a race condition into the program and result in undefined behavior.
In order to avoid data races, correctly written programs must check the result of thread synchronization functions and appropriately handle all errors, either by attempting to recover from them or reporting them to higher levels.
Example 2
The following code intends to fork a process, then have both the parent and child processes print a single line.
One might expect the code to print out something like:
However, because the parent and child are executing concurrently, and stdout is flushed each time a character is printed, the output might be mixed together, such as:
Note: this is a curated list of examples for users to understand the variety of ways in which this weakness can be introduced. It is not a complete list of all CVEs that are related to this CWE entry.
| Reference | Description |
|---|---|
|
Attacker provides invalid address to a memory-reading function, causing a mutex to be unlocked twice
|
| Ordinality | Description |
|---|---|
|
Primary
|
(where the weakness exists independent of other weaknesses)
|
| Method | Details |
|---|---|
|
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.)
|
This MemberOf Relationships table shows additional CWE Categories and Views that
reference this weakness as a member. This information is often useful in understanding where a
weakness fits within the context of external information sources.
| Nature | Type | ID | Name |
|---|---|---|---|
| MemberOf | 745 | CERT C Secure Coding Standard (2008) Chapter 12 - Signals (SIG) | |
| MemberOf | 852 | The CERT Oracle Secure Coding Standard for Java (2011) Chapter 9 - Visibility and Atomicity (VNA) | |
| MemberOf | 879 | CERT C++ Secure Coding Section 11 - Signals (SIG) | |
| MemberOf | 986 | SFP Secondary Cluster: Missing Lock | |
| MemberOf | 1142 | SEI CERT Oracle Secure Coding Standard for Java - Guidelines 08. Visibility and Atomicity (VNA) | |
| MemberOf | 1166 | SEI CERT C Coding Standard - Guidelines 11. Signals (SIG) | |
| MemberOf | 1306 | CISQ Quality Measures - Reliability | |
| MemberOf | 1308 | CISQ Quality Measures - Security | |
| MemberOf | 1340 | CISQ Data Protection Measures | |
| MemberOf | 1416 | Comprehensive Categorization: Resource Lifecycle Management |
| Usage |
DISCOURAGED
(this CWE ID should not be used to map to real-world vulnerabilities)
|
| Reason | Abstraction |
|
Rationale |
This CWE entry is a level-1 Class (i.e., a child of a Pillar). It might have lower-level children that would be more appropriate |
|
Comments |
Examine children of this entry to see if there is a better fit |
Research Gap
| Mapped Taxonomy Name | Node ID | Fit | Mapped Node Name |
|---|---|---|---|
| CERT C Secure Coding | SIG00-C | Mask signals handled by noninterruptible signal handlers | |
| CERT C Secure Coding | SIG31-C | CWE More Abstract | Do not access shared objects in signal handlers |
| CLASP | State synchronization error | ||
| The CERT Oracle Secure Coding Standard for Java (2011) | VNA03-J | Do not assume that a group of calls to independently atomic methods is atomic | |
| Software Fault Patterns | SFP19 | Missing Lock |
|
Use of the Common Weakness Enumeration (CWE™) and the associated references from this website are subject to the Terms of Use. CWE is sponsored by the U.S. Department of Homeland Security (DHS) Cybersecurity and Infrastructure Security Agency (CISA) and managed by the Homeland Security Systems Engineering and Development Institute (HSSEDI) which is operated by The MITRE Corporation (MITRE). Copyright © 2006–2026, The MITRE Corporation. CWE, CWSS, CWRAF, and the CWE logo are trademarks of The MITRE Corporation. |
||