CWE-491

Public cloneable() Method Without Final ('Object Hijack')

Medium

Description

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.

Potential Impact

How to Fix

Implementation

Make the cloneable() method final.

Detection Methods

Related Weaknesses

References

View on MITRE CWE Database →

Need Help Fixing This Vulnerability?

Our security experts can help you identify and remediate CWE-491 vulnerabilities in your codebase.

Get Security Assessment