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.
| 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.
|
| Nature | Type | ID | Name |
|---|---|---|---|
| ChildOf | Pillar Pillar - a weakness that is the most abstract type of weakness and represents a theme for all class/base/variant weaknesses related to it. A Pillar is different from a Category as a Pillar is still technically a type of weakness that describes a mistake, while a Category represents a common characteristic used to group related things. | 664 | Improper Control of a Resource Through its Lifetime |
| ChildOf | Pillar Pillar - a weakness that is the most abstract type of weakness and represents a theme for all class/base/variant weaknesses related to it. A Pillar is different from a Category as a Pillar is still technically a type of weakness that describes a mistake, while a Category represents a common characteristic used to group related things. | 691 | Insufficient Control Flow Management |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 663 | Use of a Non-reentrant Function in a Concurrent Context |
| ParentOf | 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. | 667 | Improper Locking |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 820 | Missing Synchronization |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 821 | Incorrect Synchronization |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 1058 | Invokable Control Element in Multi-Thread Context with non-Final Static Storable or Member Element |
| CanPrecede | 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. | 362 | Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') |
| Nature | Type | ID | Name |
|---|---|---|---|
| MemberOf | View View - a subset of CWE entries that provides a way of examining CWE content. The two main view structures are Slices (flat lists) and Graphs (containing relationships between entries). | 1003 | Weaknesses for Simplified Mapping of Published Vulnerabilities |
| ParentOf | 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. | 667 | Improper Locking |
| Nature | Type | ID | Name |
|---|---|---|---|
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 366 | Race Condition within a Thread |
| ParentOf | Variant Variant - a weakness that is linked to a certain type of product, typically involving a specific language or technology. More specific than a Base weakness. Variant level weaknesses typically describe issues in terms of 3 to 5 of the following dimensions: behavior, property, technology, language, and resource. | 543 | Use of Singleton Pattern Without Synchronization in a Multithreaded Context |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 567 | Unsynchronized Access to Shared Data in a Multithreaded Context |
| ParentOf | 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. | 667 | Improper Locking |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 764 | Multiple Locks of a Critical Resource |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 820 | Missing Synchronization |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 821 | Incorrect Synchronization |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 833 | Deadlock |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 1058 | Invokable Control Element in Multi-Thread Context with non-Final Static Storable or Member Element |
| ParentOf | Variant Variant - a weakness that is linked to a certain type of product, typically involving a specific language or technology. More specific than a Base weakness. Variant level weaknesses typically describe issues in terms of 3 to 5 of the following dimensions: behavior, property, technology, language, and resource. | 1096 | Singleton Class Instance Creation without Proper Locking or Synchronization |
| Nature | Type | ID | Name |
|---|---|---|---|
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 366 | Race Condition within a Thread |
| ParentOf | Variant Variant - a weakness that is linked to a certain type of product, typically involving a specific language or technology. More specific than a Base weakness. Variant level weaknesses typically describe issues in terms of 3 to 5 of the following dimensions: behavior, property, technology, language, and resource. | 543 | Use of Singleton Pattern Without Synchronization in a Multithreaded Context |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 567 | Unsynchronized Access to Shared Data in a Multithreaded Context |
| ParentOf | 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. | 667 | Improper Locking |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 764 | Multiple Locks of a Critical Resource |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 820 | Missing Synchronization |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 821 | Incorrect Synchronization |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 1058 | Invokable Control Element in Multi-Thread Context with non-Final Static Storable or Member Element |
| ParentOf | Variant Variant - a weakness that is linked to a certain type of product, typically involving a specific language or technology. More specific than a Base weakness. Variant level weaknesses typically describe issues in terms of 3 to 5 of the following dimensions: behavior, property, technology, language, and resource. | 1096 | Singleton Class Instance Creation without Proper Locking or Synchronization |
| Phase | Note |
|---|---|
| Architecture and Design | |
| Implementation |
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
|
| Nature | Type | ID | Name |
|---|---|---|---|
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 745 | CERT C Secure Coding Standard (2008) Chapter 12 - Signals (SIG) |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 852 | The CERT Oracle Secure Coding Standard for Java (2011) Chapter 9 - Visibility and Atomicity (VNA) |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 879 | CERT C++ Secure Coding Section 11 - Signals (SIG) |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 986 | SFP Secondary Cluster: Missing Lock |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1142 | SEI CERT Oracle Secure Coding Standard for Java - Guidelines 08. Visibility and Atomicity (VNA) |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1166 | SEI CERT C Coding Standard - Guidelines 11. Signals (SIG) |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1306 | CISQ Quality Measures - Reliability |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1308 | CISQ Quality Measures - Security |
| MemberOf | ViewView - a subset of CWE entries that provides a way of examining CWE content. The two main view structures are Slices (flat lists) and Graphs (containing relationships between entries). | 1340 | CISQ Data Protection Measures |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1416 | Comprehensive Categorization: Resource Lifecycle Management |
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 appropriateComments
Examine children of this entry to see if there is a better fitMaintenance
| 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 |
| Submissions | |||
|---|---|---|---|
| Submission Date | Submitter | Organization | |
|
2008年04月11日
(CWE Draft 9, 2008年04月11日) |
CWE Community | ||
| Submitted by members of the CWE community to extend early CWE versions | |||
| Modifications | |||
| Modification Date | Modifier | Organization | |
|
2024年02月29日
(CWE 4.14, 2024年02月29日) |
CWE Content Team | MITRE | |
| updated Mapping_Notes | |||
| 2023年10月26日 | CWE Content Team | MITRE | |
| updated Demonstrative_Examples, Observed_Examples | |||
| 2023年06月29日 | CWE Content Team | MITRE | |
| updated Mapping_Notes | |||
| 2023年04月27日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2023年01月31日 | CWE Content Team | MITRE | |
| updated Description | |||
| 2020年12月10日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2020年08月20日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2020年02月24日 | CWE Content Team | MITRE | |
| updated Description, Relationships | |||
| 2019年09月23日 | CWE Content Team | MITRE | |
| updated Description, Maintenance_Notes, Relationships | |||
| 2019年06月20日 | CWE Content Team | MITRE | |
| updated Type | |||
| 2019年01月03日 | CWE Content Team | MITRE | |
| updated Relationships, Taxonomy_Mappings | |||
| 2017年11月08日 | CWE Content Team | MITRE | |
| updated Taxonomy_Mappings | |||
| 2014年07月30日 | CWE Content Team | MITRE | |
| updated Relationships, Taxonomy_Mappings | |||
| 2013年07月17日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2012年10月30日 | CWE Content Team | MITRE | |
| updated Potential_Mitigations | |||
| 2012年05月11日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2011年09月13日 | CWE Content Team | MITRE | |
| updated Relationships, Taxonomy_Mappings | |||
| 2011年06月01日 | CWE Content Team | MITRE | |
| updated Common_Consequences, Relationships, Taxonomy_Mappings | |||
| 2010年12月13日 | CWE Content Team | MITRE | |
| updated Description, Relationships, Taxonomy_Mappings | |||
| 2010年09月27日 | CWE Content Team | MITRE | |
| updated Name, Relationships | |||
| 2009年05月27日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2009年03月10日 | CWE Content Team | MITRE | |
| updated Related_Attack_Patterns | |||
| 2008年11月24日 | CWE Content Team | MITRE | |
| updated Relationships, Taxonomy_Mappings | |||
| 2008年10月14日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2008年09月08日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2008年07月01日 | Eric Dalci | Cigital | |
| updated Potential_Mitigations, Time_of_Introduction | |||
| Previous Entry Names | |||
| Change Date | Previous Entry Name | ||
| 2010年09月27日 | Insufficient Synchronization | ||
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–2025, The MITRE Corporation. CWE, CWSS, CWRAF, and the CWE logo are trademarks of The MITRE Corporation.