CWE-496: Public Data Assigned to Private Array-Typed Field | Glexia
CWE-496 (Public Data Assigned to Private Array-Typed Field) weakness overview with consequences, detection methods, mitigations, related CVEs and MITRE ATT&CK…
Glexia's Take · Automated analysis
CWE-496: Public Data Assigned to Private Array-Typed Field
Public Data Assigned to Private Array-Typed Field represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.
Executive Impact
- Integrity: Modify Application Data: The contents of the array can be modified from outside the intended scope.
Developer Pattern
CWE-496 is the kind of defect developers can usually prevent with explicit validation, safer framework defaults, and tests that exercise hostile input or unsafe state transitions.
Automation confidence
high confidence from CWE-496, 4.20.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Official CWE Definition
CWE-496: Public Data Assigned to Private Array-Typed Field
Assigning public data to a private array is equivalent to giving public access to the array.
Developer And Remediation Guidance
How teams prevent and detect this weakness
Causes
- In the example below, the setRoles() method assigns a publically-controllable array to a private field, thus allowing the caller to modify the private array directly by virtue of the fact that arrays in Java are mutable.
Remediation
- Implementation: Do not allow objects to modify private members of a class.
Detection
- 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.)
Mappings
Related CVEs, CWEs, and ATT&CK context
ATT&CK Relevance
ATT&CK relevance is shown only when reviewed or responsibly inferred.
