Skip to main content

CWE-498: Cloneable Class Containing Sensitive Information

VariantDraftExploit Likelihood: Medium

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

View on MITRE
Back to CWE Lookup

Extended Description

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.

Technical Details

Structure
Simple

Applicable To

Languages
C++JavaC#
Platforms

Frequently Asked Questions

What is CWE-498: Cloneable Class Containing Sensitive Information?+

CWE-498: Cloneable Class Containing Sensitive Information is a Common Weakness Enumeration (CWE) entry maintained by MITRE. 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.

What are the security consequences of Cloneable Class Containing Sensitive Information?+

If exploited, CWE-498 (Cloneable Class Containing Sensitive Information) it can compromise Access Control, leading to outcomes such as Bypass Protection Mechanism.

How do you prevent or mitigate Cloneable Class Containing Sensitive Information?+

Recommended mitigations for CWE-498 include: If you do make your classes clonable, ensure that your clone method is final and throw super.clone().

Which programming languages are affected by Cloneable Class Containing Sensitive Information?+

CWE-498 commonly affects C++, Java and C#. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What is the difference between a CWE and a CVE?+

A CWE (Common Weakness Enumeration) like CWE-498 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.

Learn More