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

Description

The product stores a non-serializable object as an HttpSession attribute, which can hurt reliability.

Submission Date :

Dec. 15, 2006, midnight

Modification Date :

2023-06-29 00:00:00+00:00

Organization :

MITRE
Extended Description

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.

Example Vulnerable Codes

Example - 1

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


session.setAttribute("glob", this);String globName;String globValue;public void addToSession(HttpSession session) {}public class DataGlob {}

Related Weaknesses

This table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined to give an overview of the different insight to similar items that may exist at higher and lower levels of abstraction.

Visit http://cwe.mitre.org/ for more details.