15
References
[REF-960]Object Management Group (OMG). "Automated Source Code Maintainability Measure
(ASCMM)". 2016 January. < https://www.omg.org/spec/ASCMM/ >.2023-04-07.
CWE-767: Access to Critical Private Variable via Public Method
Weakness ID : 767
Structure : Simple
Abstraction : Base
Description
The product defines a public method that reads or modifies a private variable.
Extended Description
If an attacker modifies the variable to contain unexpected values, this could violate assumptions
from other parts of the code. Additionally, if an attacker can read the private variable, it may expose
sensitive information or make it easier to launch further attacks.
Relationships
The table(s) below shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOr and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition, relationships such
as PeerOf and CanAlsoBe are defined to show similar weaknesses that may want to be explored.
Relevant to the view "Research Concepts" (CWE-1000)
Nature Type ID Name Page
ChildOf 668 Exposure of Resource to Wrong Sphere 1469
Relevant to the view "Software Development" (CWE-699)
Nature Type ID Name Page
MemberOf 275 Permission Issues 2317
Applicable Platforms
Language : C++ (Prevalence = Undetermined)
Language : C# (Prevalence = Undetermined)
Language : Java (Prevalence = Undetermined)
Common Consequences
Scope Impact Likelihood
Integrity
Other
Modify Application Data
Other
Potential Mitigations
Phase: Implementation
Use class accessor and mutator methods appropriately. Perform validation when accepting
data from a public method that is intended to modify a critical private variable. Also be sure that
appropriate access controls are being applied when a public method interfaces with critical data.
Demonstrative Examples
Example 1:
CWE Version 4.14
CWE-767: Access to Critical Private Variable via Public Method
CWE-767: Access to Critical Private Variable via Public Method