CWE-767 · Słabość
Access to Critical Private Variable via Public Method
- Abstrakcja
- Bazowa
- Status
- Niekompletny
- Dodano
- 3 marca 2009
- Ostatnia zmiana
- 11 grudnia 2025
Opis
The product defines a public method that reads or modifies a private variable.
If an attacker modifies the variable to contain unexpected values, this could violate assumptions from other parts of the code. Additionally, if an attacker can read the private variable, it may expose sensitive information or make it easier to launch further attacks.
Skutki
Integrity, Other
Modify Application Data; Other
Zapobieganie
Implementation
Use class accessor and mutator methods appropriately. Perform validation when accepting data from a public method that is intended to modify a critical private variable. Also be sure that appropriate access controls are being applied when a public method interfaces with critical data.
Słabość nadrzędna
Kiedy powstaje
- Implementation
Dotyczy
C++, C#, Java
Uwagi
This entry is closely associated with access control for public methods. If the public methods are restricted with proper access controls, then the information in the private variable will not be exposed to unexpected parties. There may be chaining or composite relationships between improper access controls and this weakness.
Wpis z katalogu CWE 4.20.