---
title: "CWE-579: J2EE Bad Practices: Non-serializable Object Stored in Session"
url: https://radicalnotion.ai/cwe/cwe-579
type: cwe
description: "The product stores a non-serializable object as an HttpSession attribute."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-579: J2EE Bad Practices: Non-serializable Object Stored in Session

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

## Description

The product stores a non-serializable object as an HttpSession attribute.

## Background

A J2EE application can make use of multiple JVMs in order to improve application reliability and performance. In order to make the multiple JVMs appear as a single application to the end user, the J2EE container can replicate an HttpSession object across multiple JVMs so that if one JVM becomes unavailable, another can step in and take its place without disrupting the flow of the application. This is only possible if all session data is serializable, allowing the session to be duplicated between the JVMs.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | REALIZATION: This weakness is caused during implementation of an architectural security tactic. |

## Applicable platforms

**Languages:** Java (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Other | Quality Degradation, Reduce Reliability | - |

## Potential mitigations

### Implementation

In order for session replication to work, the values the product stores as attributes in the session must implement the Serializable interface.

## 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

The following class adds itself to the session, but because it is not serializable, the session can no longer be replicated.

Bad code:

```java
public class DataGlob {
    String globName;
    String globValue;

    public void addToSession(HttpSession session) {
        session.setAttribute("glob", this);
    }
}
```

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-573](https://radicalnotion.ai/cwe/cwe-573) | Improper Following of Specification by Caller |

## Taxonomy mappings

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

## Frequently asked questions

### What is CWE-579?

The product stores a non-serializable object as an HttpSession attribute.

### How do you prevent CWE-579?

In order for session replication to work, the values the product stores as attributes in the session must implement the Serializable interface.

### How is CWE-579 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-579?

Exploiting CWE-579 can lead to: Quality Degradation, Reduce Reliability.

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

---

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