Versions Compared

Key

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

...

Java's object cloning mechanism allows an attacker to manufacture new instances of a class by copying the memory images of existing objects rather than by executing the class's constructor. Often this is an unacceptable way of creating new objects. An attacker can misuse the clone feature to manufacture multiple instances of a singleton class, create thread-safety issues by subclassing and cloning the subclass, bypass security checks within the constructor, and violate the invariants of critical data.

Classes that have security checks in their constructors must beware of finalization attacks, as explained in rule OBJ11-J. Be wary of letting constructors throw exceptions.

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

OBJ07-J

medium

probable

medium

P8

L2

Bibliography

[McGraw 1998]

Twelve rules for developing more secure Java code

[MITRE 2009]

CWE-498. Cloneable class containing sensitive information; CWE-491. Public cloneable() method without final (aka "object hijack")

[Wheeler 2003]

10.6, Java

...

      Rule 05: Object Orientation (OBJ)Image Added