---
title: "CWE-594: J2EE Framework: Saving Unserializable Objects to Disk"
url: https://radicalnotion.ai/cwe/cwe-594
type: cwe
description: "The J2EE container attempts to write unserializable objects to disk."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-594: J2EE Framework: Saving Unserializable Objects to Disk

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Incomplete
- **CVEs with this as primary weakness:** 0
- **Of those, in CISA KEV:** 0
- **New in 2026:** 0
- **CWE catalog version:** 4.21

## Description

The J2EE container attempts to write unserializable objects to disk.

In heavy load conditions, most J2EE application frameworks flush objects to disk to manage memory requirements of incoming requests. For example, session scoped objects, and even application scoped objects, are written to disk when required. While these application frameworks do the real work of writing objects to disk, they do not enforce that those objects be serializable, thus leaving the web application vulnerable to crashes induced by serialization failure. An attacker may be able to mount a denial of service attack by sending enough requests to the server to force the web application to save objects to disk.

## Modes of introduction

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

## Applicable platforms

**Languages:** Java (Undetermined)

**Technologies:** Web Based (Undetermined), Web Server (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity | Modify Application Data | There is no guarantee that the process will complete successfully. Data represented by unserializable objects can be corrupted. |
| Availability | DoS: Crash, Exit, or Restart | Non-serializability of objects can lead to system crash. |

## Potential mitigations

### Architecture and Design, Implementation

All objects that become part of session and application scope must implement the java.io.Serializable interface to ensure serializability of containing objects.

## Demonstrative examples

### Example 1

In the following Java example, a Customer Entity JavaBean provides access to customer information in a database for a business application. The Customer Entity JavaBean is used as a session scoped object to return customer information to a Session EJB.

Bad code:

```java
@Entity
public class Customer {
    private String id;
    private String firstName;
    private String lastName;
    private Address address;

    public Customer() {
    }

    public Customer(String id, String firstName, String lastName) {...}

    @Id
    public String getCustomerId() {...}

    public void setCustomerId(String id) {...}

    public String getFirstName() {...}

    public void setFirstName(String firstName) {...}

    public String getLastName() {...}

    public void setLastName(String lastName) {...}

    @OneToOne()
    public Address getAddress() {...}

    public void setAddress(Address address) {...}

}
```

Good code:

```java
public class Customer implements Serializable {...}
```

However, the Customer Entity JavaBean is an unserialized object which can cause serialization failure and crash the application when the J2EE container attempts to write the object to the system. Session scoped objects must implement the Serializable interface to ensure that the objects serialize properly.

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-1076](https://radicalnotion.ai/cwe/cwe-1076) | Insufficient Adherence to Expected Conventions |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| Software Fault Patterns | Glitch in computation | SFP1 | - |

## Frequently asked questions

### What is CWE-594?

The J2EE container attempts to write unserializable objects to disk.

### How do you prevent CWE-594?

All objects that become part of session and application scope must implement the java.io.Serializable interface to ensure serializability of containing objects.

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

Exploiting CWE-594 can lead to: Modify Application Data, DoS: Crash, Exit, or Restart.

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

---

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