CWE-456: Missing Initialization of a Variable
CWE版本: 4.18
更新日期: 2025-09-09
弱点描述
The product does not initialize critical variables, which causes the execution environment to use unexpected values.
常见后果
影响范围: Integrity Other
技术影响: Unexpected State Quality Degradation Varies by Context
说明: The uninitialized data may be invalid, causing logic errors within the program. In some cases, this could result in a security problem.
潜在缓解措施
阶段: Implementation
策略: Attack Surface Reduction
描述: Ensure that critical variables are initialized before first use [REF-1485].
阶段: Requirements
策略: Language Selection
描述: Choose a language that is not susceptible to these issues.
检测方法
方法: 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-2020-6078
Chain: The return value of a function returning a pointer is not checked for success (CWE-252) resulting in the later use of an uninitialized variable (CWE-456) and a null pointer dereference (CWE-476)
参考: CVE-2019-3836
Chain: secure communications library does not initialize a local variable for a data structure (CWE-456), leading to access of an uninitialized pointer (CWE-824).
参考: CVE-2018-14641
Chain: C union member is not initialized (CWE-456), leading to access of invalid pointer (CWE-824)
参考: CVE-2009-2692
Chain: Use of an unimplemented network socket operation pointing to an uninitialized handler function (CWE-456) causes a crash because of a null pointer dereference (CWE-476).
参考: CVE-2020-20739
A variable that has its value set in a conditional statement is sometimes used when the conditional fails, sometimes causing data leakage
参考: CVE-2005-2978
Product uses uninitialized variables for size and index, leading to resultant buffer overflow.
参考: CVE-2005-2109
Internal variable in PHP application is not initialized, allowing external modification.
参考: CVE-2005-2193
Array variable not initialized in PHP application, leading to resultant SQL injection.
引入模式
| 阶段 | 说明 |
|---|---|
| Implementation | - |
适用平台
编程语言
分类映射
| 分类名称 | 条目ID | 条目名称 | 映射适配度 |
|---|---|---|---|
| PLOVER | - | Missing Initialization | - |
| Software Fault Patterns | SFP1 | Glitch in computation | - |
| CERT C Secure Coding | ERR30-C | Set errno to zero before calling a library function known to set errno, and check errno only after the function returns a value indicating failure | CWE More Abstract |
| SEI CERT Perl Coding Standard | DCL04-PL | Always initialize local variables | Exact |
| SEI CERT Perl Coding Standard | DCL33-PL | Declare identifiers before using them | Imprecise |
| OMG ASCSM | ASCSM-CWE-456 | - | |
| OMG ASCRM | ASCRM-CWE-456 | - |