Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this noncompliant code example [Bloch 2005], a class with singleton semantics uses the default serialized form, which fails to enforce any implementation-defined invariants. Consequently, malicious code can create a second instance even though the class should have only a single instance. For purposes of this example, we assume that the class contains only nonsensitive data.

...

Note that this compliant solution is insufficient to protect sensitive data. See rule SER03-J. Do not serialize unencrypted , sensitive data for additional information.

...

Tool
Version
Checker
Description
Coverity7.5UNSAFE_DESERIALIZATIONImplemented

Related Guidelines

MITRE CWE

CWE-502, "Deserialization of Untrusted Data"

Secure Coding Guidelines for the Java Programming Language, Version 3.0

Guideline 5-3. View deserialization the same as object construction

Bibliography

[API 2006]

Class Object, Class Hashtable

[Bloch 2008]

Item 75, Consider using a custom serialized form

[Greanier 2000]

 

[Harold 1999]

Chapter 11, Object Serialization, Validation

[Hawtin 2008]

Antipattern 8. Believing deserialisation is unrelated to construction

 

Metasploit: Java AtomicReferenceArray Type Violation Vulnerability

...