CWE-491: Public cloneable() Method Without Final ('Object Hijack')

VariantDraft

A class has a cloneable() method that is not declared final, which allows an object to be created without calling the constructor. This can cause the object to be in an unexpected state.

View on MITRE
Back to CWE Lookup

Technical Details

Structure
Simple

Applicable To

Languages
Java
Platforms

Frequently Asked Questions

What is CWE-491: Public cloneable() Method Without Final ('Object Hijack')?+

CWE-491: Public cloneable() Method Without Final ('Object Hijack') is a Common Weakness Enumeration (CWE) entry maintained by MITRE. A class has a cloneable() method that is not declared final, which allows an object to be created without calling the constructor. This can cause the object to be in an unexpected state.

What are the security consequences of Public cloneable() Method Without Final ('Object Hijack')?+

If exploited, CWE-491 (Public cloneable() Method Without Final ('Object Hijack')) it can compromise Integrity and Other, leading to outcomes such as Unexpected State and Varies by Context.

How do you prevent or mitigate Public cloneable() Method Without Final ('Object Hijack')?+

Recommended mitigations for CWE-491 include: Make the cloneable() method final.

Which programming languages are affected by Public cloneable() Method Without Final ('Object Hijack')?+

CWE-491 commonly affects Java. 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-491 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