CWE
CWE/SANS Top 25 Most Dangerous Software Errors Common Weakness Scoring System
Common Weakness Risk Analysis Framework
Home > CWE List > CWE- Individual Dictionary Definition (2.1)  

CWE-500: Public Static Field Not Marked Final

 
Public Static Field Not Marked Final
Weakness ID: 500 (Weakness Variant)Status: Draft
+ Description

Description Summary

An object contains a public static field that is not marked final, which might allow it to be modified in unexpected ways.
+ Time of Introduction
  • Implementation
+ Applicable Platforms

Languages

C++

Java

+ Common Consequences
ScopeEffect
Integrity

Technical Impact: Modify application data

The object could potentially be tampered with.

Confidentiality

Technical Impact: Read application data

The object could potentially allow the object to be read.

+ Likelihood of Exploit

High

+ Demonstrative Examples

Example 1

This is a static variable that can be read without an accessor and changed without a mutator.

(Bad Code)
Example Language: C++ 
public:
static string str = "My String";
(Bad Code)
Example Language: Java 
static public String str = "My String";
+ Potential Mitigations

Phase: Architecture and Design

Clearly identify the scope for all critical data elements, including whether they should be regarded as static.

Phase: Implementation

Make any static fields private and final.

+ Background Details

When a field is declared public but not final, the field can be read and written to by arbitrary Java code.

+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfWeakness VariantWeakness Variant493Critical Public Variable Without Final Modifier
Development Concepts (primary)699
Research Concepts (primary)1000
ChildOfCategoryCategory849CERT Java Secure Coding Section 04 - Object Orientation (OBJ)
Weaknesses Addressed by the CERT Java Secure Coding Standard (primary)844
+ Taxonomy Mappings
Mapped Taxonomy NameNode IDFitMapped Node Name
CLASPOverflow of static internal buffer
CERT Java Secure CodingOBJ04-JDo not use public static non-final variables
+ White Box Definitions

A weakness where code path has a statement that defines a public field that is static and non-final

+ Content History
Submissions
Submission DateSubmitterOrganizationSource
CLASPExternally Mined
Modifications
Modification DateModifierOrganizationSource
2008-07-01Eric DalciCigitalExternal
updated Time_of_Introduction
2008-08-01KDM AnalyticsExternal
added/updated white box definitions
2008-09-08CWE Content TeamMITREInternal
updated Applicable_Platforms, Common_Consequences, Relationships, Other_Notes, Taxonomy_Mappings
2008-11-05CWE Content TeamMITREInternal
Significant clarification of this entry, and improved examples.
2008-11-24CWE Content TeamMITREInternal
updated Background_Details, Demonstrative_Examples, Description, Name, Other_Notes, Potential_Mitigations
2009-05-27CWE Content TeamMITREInternal
updated Relationships
2011-06-01CWE Content TeamMITREInternal
updated Common_Consequences, Relationships, Taxonomy_Mappings
Previous Entry Names
Change DatePrevious Entry Name
2008-04-11Overflow of Static Internal Buffer
2008-11-24Static Field Not Marked Final
Page Last Updated: September 12, 2011