---
title: "CWE-499: Serializable Class Containing Sensitive Data"
url: https://radicalnotion.ai/cwe/cwe-499
type: cwe
description: "The code contains a class with sensitive data, but the class does not explicitly deny serialization."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-499: Serializable Class Containing Sensitive Data

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Draft
- **Likelihood of exploit:** High
- **CVEs with this as primary weakness:** 1
- **Of those, in CISA KEV:** 0
- **New in 2026:** 0
- **CWE catalog version:** 4.21

## Description

The code contains a class with sensitive data, but the class does not explicitly deny serialization.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Applicable platforms

**Languages:** Java (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| 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.)

Effectiveness: High

## Demonstrative examples

### Example 1

This code creates a new record for a medical patient:

Bad code:

```java
class PatientRecord {
    private String name;
    private String socialSecurityNum;
    public Patient(String name,String ssn) {
        this.SetName(name);
        this.SetSocialSecurityNumber(ssn);
    }
}
```

This object does not explicitly deny serialization, allowing an attacker to serialize an instance of this object and gain a patient's name and Social Security number even though those fields are private.

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2024-5657 | CraftCMS Plugin - Two-Factor Authentication - Password Hash Disclosure | high | 8.1 | - | No | 2024-06-06 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-668](https://radicalnotion.ai/cwe/cwe-668) | Exposure of Resource to Wrong Sphere |
| Can precede | [CWE-200](https://radicalnotion.ai/cwe/cwe-200) | Exposure of Sensitive Information to an Unauthorized Actor |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| CLASP | Information leak through serialization | - | - |
| The CERT Oracle Secure Coding Standard for Java (2011) | Do not serialize unencrypted, sensitive data | SER03-J | - |
| The CERT Oracle Secure Coding Standard for Java (2011) | Do not serialize instances of inner classes | SER05-J | - |
| Software Fault Patterns | Exposed Data | SFP23 | - |

## Frequently asked questions

### What is CWE-499?

The code contains a class with sensitive data, but the class does not explicitly deny serialization.

### What CVEs are caused by CWE-499?

1 recorded CVE is attributed to CWE-499: CVE-2024-5657.

### How do you prevent CWE-499?

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.

### How is CWE-499 detected?

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.)

### What are the consequences of CWE-499?

Exploiting CWE-499 can lead to: Read Application Data.

### Is CWE-499 actively exploited?

1 recorded CVE is caused by CWE-499; it is not currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/499.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-499). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
