Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CWE-767 (通过公开方法可访问到关键的私有数据) — Vulnerability Class 4

4 vulnerabilities classified as CWE-767 (通过公开方法可访问到关键的私有数据). AI Chinese analysis included.

CWE-767 represents an access control weakness where a class exposes a private variable through a public method, effectively bypassing intended encapsulation boundaries. This flaw typically allows attackers to read sensitive internal state or modify critical variables with unexpected values, violating code assumptions and potentially exposing confidential data or facilitating further exploitation. Developers mitigate this risk by strictly adhering to encapsulation principles, ensuring private variables remain inaccessible outside their defining class. Instead of exposing raw variables, developers should implement controlled accessors or mutators that validate inputs and enforce business logic constraints. By limiting direct variable access and ensuring internal state integrity, organizations prevent unauthorized manipulation and maintain robust security postures against internal logic abuse.

MITRE CWE Description
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.
Common Consequences (1)
Integrity, OtherModify Application Data, Other
Mitigations (1)
ImplementationUse 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.
Examples (2)
The following example declares a critical variable to be private, and then allows the variable to be modified by public methods.
private: float price; public: void changePrice(float newPrice) { price = newPrice; }
Bad · C++
The following example could be used to implement a user forum where a single user (UID) can switch between multiple profiles (PID).
public class Client { private int UID; public int PID; private String userName; public Client(String userName){ PID = getDefaultProfileID(); UID = mapUserNametoUID( userName ); this.userName = userName; } public void setPID(int ID) { UID = ID; } }
Bad · Java
CVE IDTitleCVSSSeverityPublished
CVE-2024-36463 Zabbix 安全漏洞 — Zabbix 6.5 Medium2024-11-26
CVE-2024-34162 Sharp MFP 安全漏洞 — Multiple MFPs (multifunction printers) 5.3 Medium2024-11-26
CVE-2020-26868 ARC Informatique PcVue Access to Critical Private Variable via Public Method — PcVue 7.5 High2020-10-12
CVE-2016-8380 Phoenix Contact ILC PLC 授权问题漏洞 — Phoenix Contact ILC PLCs 7.3 -2018-04-05

Vulnerabilities classified as CWE-767 (通过公开方法可访问到关键的私有数据) represent 4 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.