CWE-498 — Cloneable Class Containing Sensitive Information
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
See all 1,245 pages under Weakness classes (CWE) →
Related pages
Browse by topic
Every page in the corpus, grouped. Search finds one page; this shows what else is here.