| Impact | Details |
|---|---|
|
Modify Application Data; Alter Execution Logic |
Scope: Integrity, Other |
| Phase(s) | Mitigation |
|---|---|
|
Implementation |
While double-checked locking can be achieved in some languages, it is inherently flawed in Java before 1.5, and cannot be achieved without compromising platform independence. Before Java 1.5, only use of the synchronized keyword is known to work. Beginning in Java 1.5, use of the "volatile" keyword allows double-checked locking to work successfully, although there is some debate as to whether it achieves sufficient performance gains. See references.
|
| Nature | Type | ID | Name |
|---|---|---|---|
| ChildOf | 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 |
| CanPrecede | 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. | 367 | Time-of-check Time-of-use (TOCTOU) Race Condition |
| Nature | Type | ID | Name |
|---|---|---|---|
| MemberOf | Category Category - a CWE entry that contains a set of other entries that share a common characteristic. | 411 | Resource Locking Problems |
| Phase | Note |
|---|---|
| Implementation |
Java (Undetermined Prevalence)
Example 1
It may seem that the following bit of code achieves thread safety while avoiding unnecessary synchronization...
The programmer wants to guarantee that only one Helper() object is ever allocated, but does not want to pay the cost of synchronization every time this code is called.
Suppose that helper is not initialized. Then, thread A sees that helper==null and enters the synchronized block and begins to execute:
If a second thread, thread B, takes over in the middle of this call and helper has not finished running the constructor, then thread B may make calls on helper while its fields hold incorrect values.
| Nature | Type | ID | Name |
|---|---|---|---|
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 853 | The CERT Oracle Secure Coding Standard for Java (2011) Chapter 10 - Locking (LCK) |
| 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. | 1143 | SEI CERT Oracle Secure Coding Standard for Java - Guidelines 09. Locking (LCK) |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1401 | Comprehensive Categorization: Concurrency |
Rationale
This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.Comments
Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.| Mapped Taxonomy Name | Node ID | Fit | Mapped Node Name |
|---|---|---|---|
| The CERT Oracle Secure Coding Standard for Java (2011) | LCK10-J | Do not use incorrect forms of the double-checked locking idiom | |
| Software Fault Patterns | SFP19 | Missing Lock |
| Submissions | |||
|---|---|---|---|
| Submission Date | Submitter | Organization | |
|
2007年05月07日
(CWE Draft 6, 2007年05月07日) |
Anonymous Tool Vendor (under NDA) | ||
| Modifications | |||
| Modification Date | Modifier | Organization | |
|
2025年04月03日
(CWE 4.17, 2025年04月03日) |
CWE Content Team | MITRE | |
| updated Demonstrative_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年02月24日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2019年01月03日 | CWE Content Team | MITRE | |
| updated Relationships, Taxonomy_Mappings | |||
| 2014年07月30日 | CWE Content Team | MITRE | |
| updated Relationships, Taxonomy_Mappings | |||
| 2012年10月30日 | CWE Content Team | MITRE | |
| updated Potential_Mitigations | |||
| 2012年05月11日 | CWE Content Team | MITRE | |
| updated Demonstrative_Examples, References, Relationships | |||
| 2011年06月01日 | CWE Content Team | MITRE | |
| updated Common_Consequences, Relationships, Taxonomy_Mappings | |||
| 2010年12月13日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2009年10月29日 | CWE Content Team | MITRE | |
| updated Taxonomy_Mappings | |||
| 2009年05月27日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2009年01月12日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2008年11月24日 | CWE Content Team | MITRE | |
| updated Demonstrative_Examples | |||
| 2008年09月08日 | CWE Content Team | MITRE | |
| updated Description, Relationships, Taxonomy_Mappings | |||
| 2008年07月01日 | Eric Dalci | Cigital | |
| updated Context_Notes | |||
| Previous Entry Names | |||
| Change Date | Previous Entry Name | ||
| 2008年04月11日 | Double Checked Locking | ||
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.