Katalog CWE

CWE-374 · Słabość

Passing Mutable Objects to an Untrusted Method

Abstrakcja
Bazowa
Status
Szkic
Ryzyko wykorzystania
średnie
Dodano
19 lipca 2006
Ostatnia zmiana
11 grudnia 2025

Podatności CVE z tą słabościąPełny wpis na cwe.mitre.org ↗

Opis

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

The function or method that has been called can alter or delete the mutable data. This could violate assumptions that the calling function has made about its state. In situations where unknown code is called with references to mutable data, this external code could make changes to the data sent. If this data was not previously cloned, the modified data might not be valid in the context of execution.

Skutki

  • Integrity

    Modify Memory

    Potentially data could be tampered with by another function which should not have been tampered with.

Zapobieganie

  • 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.

Słabość nadrzędna

Kiedy powstaje

Dotyczy

Object-Oriented, C, C++, Java, C#

Źródła

  1. The CLASP Application Security Process — Secure Software, Inc., 2005
  2. Does Java pass by reference or pass by value? — Tony Sintes, JavaWorld.com, 2000
  3. Java: The Complete Reference, J2SE 5th Edition — Herbert Schildt

Wpis z katalogu CWE 4.20.