Katalog CWE

CWE-495 · Słabość

Private Data Structure Returned From A Public Method

Abstrakcja
Wariant
Status
Szkic
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 has a method that is declared public, but returns a reference to a private data structure, which could then be modified in unexpected ways.

Skutki

  • Integrity

    Modify Application Data

    The contents of the data structure can be modified from outside the intended scope.

Zapobieganie

  • Implementation

    Declare the method private.

  • Implementation

    Clone the member data and keep an unmodified version of the data private to the object.

  • Implementation

    Use public setter methods that govern how a private member can be modified.

Słabość nadrzędna

Kiedy powstaje

Dotyczy

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

Źródła

  1. Seven Pernicious Kingdoms: A Taxonomy of Software Security Errors — Katrina Tsipenyuk, Brian Chess, Gary McGraw, NIST, 2005

Wpis z katalogu CWE 4.20.