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-607: Public Static Final Field References Mutable Object

 
Public Static Final Field References Mutable Object
Weakness ID: 607 (Weakness Variant)Status: Draft
+ Description

Description Summary

A public or protected static final field references a mutable object, which allows the object to be changed by malicious code, or accidentally from another package.
+ Time of Introduction
  • Implementation
+ Applicable Platforms

Languages

Java

+ Common Consequences
ScopeEffect
Integrity

Technical Impact: Modify application data

+ Demonstrative Examples

Example 1

Here, an array (which is inherently mutable) is labeled public static final.

(Bad Code)
Example Language: Java 
public static final String[] USER_ROLES;
+ Potential Mitigations

Protect mutable objects by making them private. Restrict access to the getter and setter as well.

+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfWeakness BaseWeakness Base471Modification of Assumed-Immutable Data (MAID)
Development Concepts699
Research Concepts (primary)1000
ChildOfWeakness ClassWeakness Class485Insufficient Encapsulation
Development Concepts (primary)699
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
Anonymous Tool Vendor (under NDA)
CERT Java Secure CodingOBJ02-JNever conflate immutability of a reference with that of the referenced object
+ Content History
Submissions
Submission DateSubmitterOrganizationSource
Anonymous Tool Vendor (under NDA)Externally Mined
Modifications
Modification DateModifierOrganizationSource
2008-07-01Sean EidemillerCigitalExternal
added/updated demonstrative examples
2008-07-01Eric DalciCigitalExternal
updated Potential_Mitigations, Time_of_Introduction
2008-09-08CWE Content TeamMITREInternal
updated Relationships, Taxonomy_Mappings
2011-06-01CWE Content TeamMITREInternal
updated Common_Consequences, Relationships, Taxonomy_Mappings
Page Last Updated: September 12, 2011