CWE-495 从公开方法中返回私有的数组类型数据域 类弱点 1 条 CVE 漏洞汇总,含 AI 中文分析。
CWE-495属于数据访问控制漏洞。当公共方法返回私有数据结构的引用时,攻击者可绕过封装限制,直接修改内部状态,导致程序逻辑混乱或数据泄露。开发者应避免直接暴露内部对象引用,转而返回数据的副本或只读视图,确保私有数据的完整性与安全性,从而有效防御此类越权访问风险。
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 | 标题 | CVSS | 风险等级 | Published |
|---|---|---|---|---|
| CVE-2025-29868 | Apache Answer 安全漏洞 — Apache Answer | 6.5 | - | 2025-04-01 |
CWE-495(从公开方法中返回私有的数组类型数据域) 是常见的弱点类别,本平台收录该类弱点关联的 1 条 CVE 漏洞。