Modes Of Introduction
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.
Applicable Platforms
Language
Name: C (Sometimes)
Name: C++ (Sometimes)
Name: Perl (Often)
Name: PHP (Often)
Class: Not Language-Specific (Undetermined)
Common Consequences
Scope |
Impact |
Likelihood |
Availability Integrity Other | Other
Note: Initial variables usually contain junk, which can not be trusted for consistency. This can lead to denial of service conditions, or modify control flow in unexpected ways. In some cases, an attacker can "pre-initialize" the variable using previous actions, which might enable code execution. This can cause a race condition if a lock variable check passes when it should not. | |
Authorization Other | Other
Note: 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. | |
Observed Examples
References |
Description |
| 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). |
| 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. |
| Uninitialized variable leads to code execution in popular desktop application. |
| Crafted input triggers dereference of an uninitialized object pointer. |
| Crafted audio file triggers crash when an uninitialized variable is used. |
| Uninitialized random seed variable used. |
Potential Mitigations
Phases : Implementation
Assign all variables to an initial value.
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
The choice could be made to use 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.
Detection Methods
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.
Effectiveness : 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.)
Effectiveness : High
Vulnerability Mapping Notes
Justification : 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.
Comment : 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.
References
REF-18
The CLASP Application Security Process
Secure Software, Inc..
https://cwe.mitre.org/documents/sources/TheCLASPApplicationSecurityProcess.pdf REF-436
Exploiting Uninitialized Data
mercy.
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.
Submission
Name |
Organization |
Date |
Date release |
Version |
CLASP |
|
2006-07-19 +00:00 |
2006-07-19 +00:00 |
Draft 3 |
Modifications
Name |
Organization |
Date |
Comment |
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 |