CWEweakness
CWE-499 Serializable Class Containing Sensitive Data
High
Official page ↗
- Abstraction
- Variant
- Structure
- Simple
- Status
- Draft
- Likelihood of exploit
- High
- Languages
- Java
- CWE version
- 5.0
Description
The code contains a class with sensitive data, but the class does not explicitly deny serialization.
Common consequences
• Confidentiality: Read Application Data — 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. The data can be accessed by serializing the class through another class. Alternately, an attacker can write out the class to a byte stream, then extract the important data from it.
Potential mitigations
• [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.
• [Implementation] Make sure to prevent serialization of your objects.
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.)
Related
Can precede · CWE (1)
- CWE-200 Exposure of Sensitive Information to an Unauthorized Actor weakness
Child of · CWE (1)
- CWE-668 Exposure of Resource to Wrong Sphere weakness
Referenced by CVE · weakness (2)
- CVE-2024-5657 The CraftCMS plugin Two-Factor Authentication in versions 3.3.1, 3.3.2 and 3.3.3 discloses the password hash of the currently authenticated… vulnerability
- CVE-2022-39309 GoCD is a continuous delivery server. vulnerability
Referenced by CWE · has member (1)
- CWE-884 CWE Cross-section view