CWE-457 詳細

CWE-457

Use of Uninitialized Variable
2006-07-19
00h00 +00:00
高
Draft
2026-10-28
00h00 +00:00
特定のCWEの通知
特定のCWEの変更情報をいち早くお届けします。
通知を管理する

名前: Use of Uninitialized Variable

The code uses a variable that has not been initialized, leading to unpredictable or unintended results.

一般情報

背景の詳細

導入モード

Implementation : The presence of an uninitialized variable can sometimes indicate a typographic error in the code.
Implementation : In C, using an uninitialized char * in some string libraries will return incorrect results, as the libraries expect the null terminator to always be at the end of a string, even if the string is empty.

適用可能なプラットフォーム

言語

名前: C (Sometimes)
名前: C++ (Sometimes)
名前: Perl (Often)
名前: PHP (Often)
クラス: Not Language-Specific (Undetermined)

一般的な結果

スコープ 影響 可能性
Confidentiality
Integrity
Availability
Other
Varies by Context, Read Application Data

注記:Uninitialized variables usually contain junk, which can not be trusted for consistency. Depending on the context, uninitialized variables could lead to denial of service conditions, or modify control flow in unexpected ways. They could also contain sensitive information that could be leaked if the variable is used in output. In some cases, an attacker can "pre-initialize" the variable using previous actions - i.e., control the contents of the variable - which might enable code execution.
AvailabilityAlter Execution Logic, Unexpected State

注記:This can cause a race condition if a lock variable check passes when it should not.
Authorization
Other
Varies by Context

注記:Strings that are not initialized are especially dangerous, since many functions expect a null at the end -- and only at the end -- of a string.

観察された例

参考文献 説明

CVE-2019-15900

Chain: sscanf() call is used to check if a username and group exists, but the return value of sscanf() call is not checked (CWE-252), causing an uninitialized variable to be checked (CWE-457), returning success to allow authorization bypass for executing a privileged (CWE-863).

CVE-2008-3688

Chain: A denial of service may be caused by an uninitialized variable (CWE-457) allowing an infinite loop (CWE-835) resulting from a connection to an unresponsive server.

CVE-2008-0081

Uninitialized variable leads to code execution in popular desktop application.

CVE-2007-4682

Crafted input triggers dereference of an uninitialized object pointer.

CVE-2007-3468

Crafted audio file triggers crash when an uninitialized variable is used.

CVE-2007-2728

Uninitialized random seed variable used.

潜在的な緩和策

Phases : Implementation
Ensure that critical variables are initialized before first use [REF-1485].
Phases : Build and Compilation
Most compilers will complain about the use of uninitialized variables if warnings are turned on.
Phases : Implementation // Operation
When using a language that does not require explicit declaration of variables, run or compile the software in a mode that reports undeclared or unknown variables. This may indicate the presence of a typographic error in the variable's name.
Phases : Requirements
Choose a language that is not susceptible to these issues.
Phases : Architecture and Design
Mitigating technologies such as safe string libraries and container abstractions could be introduced.

検出方法

Fuzzing

Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs - either randomly or algorithmically - and dynamically invoking the code with those inputs. Even with random inputs, it is often capable of generating unexpected results such as crashes, memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases that clearly indicate bugs, which helps developers to diagnose the issues.
有効性 : High

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

脆弱性マッピングノート

理由 : This CWE entry is at the Variant level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.
コメント : Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.

参考文献

REF-18

The CLASP Application Security Process
Secure Software, Inc..
https://cwe.mitre.org/documents/sources/TheCLASPApplicationSecurityProcess.pdf

REF-436

Exploiting Uninitialized Data
mercy.
https://web.archive.org/web/20070403193636/http://www.felinemenace.org/~mercy/papers/UBehavior/UBehavior.zip

REF-437

MS08-014 : The Case of the Uninitialized Stack Variable Vulnerability
Microsoft Security Vulnerability Research & Defense.
https://msrc.microsoft.com/blog/2008/03/ms08-014-the-case-of-the-uninitialized-stack-variable-vulnerability/

REF-44

24 Deadly Sins of Software Security
Michael Howard, David LeBlanc, John Viega.

REF-62

The Art of Software Security Assessment
Mark Dowd, John McDonald, Justin Schuh.

REF-1485

D3FEND: D3-VI Variable Initialization
D3FEND.
https://d3fend.mitre.org/technique/d3f:VariableInitialization/

REF-1534

Automated Technical Debt Measure, Version 2
OMG.
https://www.omg.org/spec/ATDM2/1.0/PDF

登録情報

名前 組織 日付 リリース日 Version
CLASP 2006-07-19 +00:00 2006-07-19 +00:00 Draft 3

変更履歴

名前 組織 日付 コメント
Eric Dalci Cigital 2008-07-01 +00:00 updated Time_of_Introduction
KDM Analytics 2008-08-01 +00:00 added/updated white box definitions
CWE Content Team MITRE 2008-09-08 +00:00 updated Applicable_Platforms, Common_Consequences, Description, Relationships, Observed_Example, Other_Notes, References, Taxonomy_Mappings
CWE Content Team MITRE 2009-01-12 +00:00 updated Common_Consequences, Demonstrative_Examples, Potential_Mitigations
CWE Content Team MITRE 2009-03-10 +00:00 updated Demonstrative_Examples
CWE Content Team MITRE 2009-05-27 +00:00 updated Demonstrative_Examples
CWE Content Team MITRE 2011-06-01 +00:00 updated Common_Consequences
CWE Content Team MITRE 2012-05-11 +00:00 updated References, Relationships
CWE Content Team MITRE 2012-10-30 +00:00 updated Demonstrative_Examples
CWE Content Team MITRE 2013-02-21 +00:00 updated Applicable_Platforms, Description, Other_Notes, Potential_Mitigations, Relationships
CWE Content Team MITRE 2014-06-23 +00:00 updated Modes_of_Introduction, Other_Notes
CWE Content Team MITRE 2014-07-30 +00:00 updated Relationships, Taxonomy_Mappings
CWE Content Team MITRE 2017-11-08 +00:00 updated References, Relationships, Taxonomy_Mappings, White_Box_Definitions
CWE Content Team MITRE 2019-01-03 +00:00 updated Taxonomy_Mappings
CWE Content Team MITRE 2019-06-20 +00:00 updated Relationships, Type
CWE Content Team MITRE 2020-02-24 +00:00 updated References, Relationships, Type
CWE Content Team MITRE 2020-08-20 +00:00 updated Relationships
CWE Content Team MITRE 2020-12-10 +00:00 updated Relationships
CWE Content Team MITRE 2021-03-15 +00:00 updated Demonstrative_Examples, Observed_Examples, Relationships
CWE Content Team MITRE 2021-07-20 +00:00 updated Observed_Examples
CWE Content Team MITRE 2023-04-27 +00:00 updated Detection_Factors, References, Relationships
CWE Content Team MITRE 2023-06-29 +00:00 updated Mapping_Notes
CWE Content Team MITRE 2025-09-09 +00:00 updated Potential_Mitigations, References
CWE Content Team MITRE 2025-12-11 +00:00 updated Weakness_Ordinalities
CWE Content Team MITRE 2026-10-28 +00:00 updated Background_Details, Common_Consequences, Description, Modes_of_Introduction, References