Umbra Wiki weakness weakness/CWE-498
Back to wiki

CWE-498 — Cloneable Class Containing Sensitive Information

provenance: imported · CWE: CWE-498

CWE-498: Cloneable Class Containing Sensitive Information

MITRE CWE weakness

Kind Weakness
Abstraction Variant
Status Draft
Likelihood of exploit Medium

Description

The code contains a class with sensitive data, but the class is cloneable. The data can then be accessed by cloning the class.

Cloneable classes are effectively open classes, since data cannot be hidden in them. Classes that do not explicitly deny cloning can be cloned by any other class without running the constructor.

Common consequences

  • Access Control: Bypass Protection Mechanism

Mitigations

Implementation — If you do make your classes clonable, ensure that your clone method is final and throw super.clone().

References

  • CWE page: https://cwe.mitre.org/data/definitions/498.html
  • CWE list: https://cwe.mitre.org/data/index.html