CWE-374

Passing Mutable Objects to an Untrusted Method

Medium

Description

The product sends non-cloned mutable data as an argument to a method or function.

Potential Impact

How to Fix

Implementation

Pass in data which should not be altered as constant or immutable.

Implementation

Clone all mutable data before passing it into an external function . This is the preferred mitigation. This way, regardless of what changes are made to the data, a valid copy is retained for use by the class.

Related Weaknesses

References

View on MITRE CWE Database →

Need Help Fixing This Vulnerability?

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

Get Security Assessment