1 vulnerabilities classified as CWE-495 (从公开方法中返回私有的数组类型数据域). AI Chinese analysis included.
CWE-495 represents a critical design flaw where a public method inadvertently exposes a reference to an internal, private data structure rather than a safe copy or immutable view. This weakness undermines encapsulation, allowing external code to directly manipulate the object’s internal state. Attackers typically exploit this vulnerability by invoking the public accessor to obtain the reference, then modifying the underlying data to corrupt application logic, bypass security checks, or trigger unexpected behaviors. To mitigate this risk, developers must ensure that public interfaces return defensive copies of mutable objects or utilize immutable data types. Additionally, implementing strict access controls and validating data integrity at boundaries can prevent unauthorized modifications, thereby preserving the intended state and security posture of the software system.
private String[] colors; public String[] getColors() { return colors; }class Color { private: int[2] colorArray; int colorValue; public: Color () : colorArray { 1, 2 }, colorValue (3) { }; int[2] & fa () { return colorArray; } // return reference to private array int & fv () { return colorValue; } // return reference to private integer }; int main () { Color c; c.fa () [1] = 42; // modifies private array element c.fv () = 42; // modifies private int return 0; }| CVE ID | Title | CVSS | Severity | Published |
|---|---|---|---|---|
| CVE-2025-29868 | Apache Answer: Using externally referenced images can leak user privacy. — Apache Answer | 6.5 | - | 2025-04-01 |
Vulnerabilities classified as CWE-495 (从公开方法中返回私有的数组类型数据域) represent 1 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.