1199
Description
The code contains a class with sensitive data, but the class does not explicitly deny serialization.
The data can be accessed by serializing the class through another class.
Extended Description
Serializable classes are effectively open classes since data cannot be hidden in them. Classes that
do not explicitly deny serialization can be serialized by any other class, which can then in turn use
the data stored inside it.
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
CanPrecede 200 Exposure of Sensitive Information to an Unauthorized Actor 504
Applicable Platforms
Language : Java (Prevalence = Undetermined)
Likelihood Of Exploit
High
Common Consequences
Scope Impact Likelihood
Confidentiality Read Application Data
an attacker can write out the class to a byte stream, then
extract the important data from it.
Detection Methods
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
Potential Mitigations
Phase: Implementation
In Java, explicitly define final writeObject() to prevent serialization. This is the recommended
solution. Define the writeObject() function to throw an exception explicitly denying serialization.
Phase: Implementation
Make sure to prevent serialization of your objects.
Demonstrative Examples
Example 1:
This code creates a new record for a medical patient:
CWE Version 4.14
CWE-500: Public Static Field Not Marked Final
CWE-500: Public Static Field Not Marked Final