CWE-499: Serializable Class Containing Sensitive Data

VariantDraftExploit Likelihood: High

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.

View on MITRE
Back to CWE Lookup

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.

Technical Details

Structure
Simple

Applicable To

Languages
Java
Platforms

Frequently Asked Questions

What is CWE-499: Serializable Class Containing Sensitive Data?+

CWE-499: Serializable Class Containing Sensitive Data is a Common Weakness Enumeration (CWE) entry maintained by MITRE. 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. 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.

What are the security consequences of Serializable Class Containing Sensitive Data?+

If exploited, CWE-499 (Serializable Class Containing Sensitive Data) it can compromise Confidentiality, leading to outcomes such as Read Application Data.

How do you prevent or mitigate Serializable Class Containing Sensitive Data?+

Recommended mitigations for CWE-499 include: 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. Make sure to prevent serialization of your objects.

Which programming languages are affected by Serializable Class Containing Sensitive Data?+

CWE-499 commonly affects Java. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What is the difference between a CWE and a CVE?+

A CWE (Common Weakness Enumeration) like CWE-499 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.

Learn More