CWE-766: Critical Data Element Declared Public

Base Incomplete Simple

CWE版本: 4.18

更新日期: 2025-09-09

弱点描述

The product declares a critical variable, field, or member to be public when intended security policy requires it to be private.

常见后果

影响范围: Integrity Confidentiality

技术影响: Read Application Data Modify Application Data

说明: Making a critical variable public allows anyone with access to the object in which the variable is contained to alter or read the value.

影响范围: Other

技术影响: Reduce Maintainability

潜在缓解措施

阶段: Implementation

描述: Data should be private, static, and final whenever possible. This will assure that your code is protected by instantiating early, preventing access, and preventing tampering.

检测方法

方法: Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

有效性: High

观察示例

参考: CVE-2010-3860

variables declared public allow remote read of system properties such as user name and home directory.

引入模式

阶段 说明
Implementation -

适用平台

编程语言
C++ (Undetermined) C# (Undetermined) Java (Undetermined)

分类映射

分类名称 条目ID 条目名称 映射适配度
CLASP - Failure to protect stored data from modification -
The CERT Oracle Secure Coding Standard for Java (2011) OBJ01-J Declare data members as private and provide accessible wrapper methods -
Software Fault Patterns SFP28 Unexpected access points -
OMG ASCMM ASCMM-MNT-15 -
关键信息

CWE ID: CWE-766

抽象级别: Base

结构: Simple

状态: Incomplete

相关弱点