Within servlets, shared static variables are not protected from concurrent access, but servlets are multithreaded. This is a typical programming mistake in J2EE applications, since the multithreading is handled by the framework. When a shared variable can be influenced by an attacker, one thread could wind up modifying the variable to contain data that is not valid for a different thread that is also using the data within the variable.
Note that this weakness is not unique to servlets.
| Impact | Details |
|---|---|
|
Read Application Data; Modify Application Data; DoS: Instability; DoS: Crash, Exit, or Restart |
Scope: Confidentiality, Integrity, Availability
If the shared variable contains sensitive data, it may be manipulated or displayed in another user session. If this data is used to control the application, its value can be manipulated to cause the application to crash or perform poorly.
|
| Phase(s) | Mitigation |
|---|---|
|
Implementation |
Remove the use of static variables used between servlets. If this cannot be avoided, use synchronized access for these variables.
|
| Nature | Type | ID | Name |
|---|---|---|---|
| ChildOf | 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 |
| 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. | 488 | Exposure of Data Element to Wrong Session |
| 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. | 662 | Improper Synchronization |
| 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. | 662 | Improper Synchronization |
| Phase | Note |
|---|---|
| Implementation |
Java (Undetermined Prevalence)
Example 1
The following code implements a basic counter for how many times the page has been accesed.
Consider when two separate threads, Thread A and Thread B, concurrently handle two different requests:
At this point, both Thread A and Thread B print that one hit has been seen, even though two separate requests have been processed. The value of count should be 2, not 1.
While this example does not have any real serious implications, if the shared variable in question is used for resource tracking, then resource consumption could occur. Other scenarios exist.
| 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.)
Effectiveness: High |
| Nature | Type | ID | Name |
|---|---|---|---|
| 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 | 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). | 884 | CWE Cross-section |
| 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. | 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) | VNA00-J | Ensure visibility when accessing shared primitive variables | |
| The CERT Oracle Secure Coding Standard for Java (2011) | VNA02-J | Ensure that compound operations on shared variables are atomic | |
| Software Fault Patterns | SFP19 | Missing Lock |
| CAPEC-ID | Attack Pattern Name |
|---|---|
| CAPEC-25 | Forced Deadlock |
| Submissions | |||
|---|---|---|---|
| Submission Date | Submitter | Organization | |
|
2006年12月15日
(CWE Draft 5, 2006年12月15日) |
CWE Community | ||
| Submitted by members of the CWE community to extend early CWE versions | |||
| Modifications | |||
| Modification Date | Modifier | Organization | |
| 2023年06月29日 | CWE Content Team | MITRE | |
| updated Mapping_Notes | |||
| 2023年04月27日 | CWE Content Team | MITRE | |
| updated Detection_Factors, Relationships, Time_of_Introduction | |||
| 2020年12月10日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2020年08月20日 | CWE Content Team | MITRE | |
| updated Relationships | |||
| 2019年01月03日 | CWE Content Team | MITRE | |
| updated Relationships, Taxonomy_Mappings | |||
| 2017年11月08日 | CWE Content Team | MITRE | |
| updated Applicable_Platforms | |||
| 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年06月01日 | CWE Content Team | MITRE | |
| updated Common_Consequences, Relationships, Taxonomy_Mappings | |||
| 2010年12月13日 | CWE Content Team | MITRE | |
| updated Applicable_Platforms, Common_Consequences, Demonstrative_Examples, Description, Name, Other_Notes, Potential_Mitigations, Relationships | |||
| 2010年12月09日 | CWE Content Team | MITRE | |
| Made name and description more specific to match the essence of the rest of the entry. | |||
| 2010年09月27日 | CWE Content Team | MITRE | |
| updated Other_Notes | |||
| 2008年09月08日 | CWE Content Team | MITRE | |
| updated Relationships, Other_Notes | |||
| 2008年07月01日 | Eric Dalci | Cigital | |
| updated Time_of_Introduction | |||
| Previous Entry Names | |||
| Change Date | Previous Entry Name | ||
| 2010年12月13日 | Unsynchronized Access to Shared Data | ||
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.