Missing Initialization |
Weakness ID: 456 (Weakness Base) | Status: Draft |
Description Summary
The software does not initialize critical variables, which causes the execution environment to use unexpected values.
Example 1
Here, an uninitialized field in a Java class is used in a seldom-called method, which would cause a NullPointerException to be thrown.
(Bad Code)
Example Language: Java
private User user;
public void someMethod() {
// Do something interesting.
...
// Throws NPE if user hasn't been properly initialized.
String username = user.getName();
}
Reference | Description |
---|---|
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. |
Check that critical variables are initialized. |
Use a static analysis tool to spot non-initialized variables. |
This weakness is a major factor in a number of resultant weaknesses, especially in web applications that allow global variable initialization (such as PHP) with libraries that can be directly requested. |
Nature | Type | ID | Name | View(s) this relationship pertains to![]() |
---|---|---|---|---|
ChildOf | ![]() | 452 | Initialization and Cleanup Errors | Development Concepts (primary)699 |
ChildOf | ![]() | 665 | Improper Initialization | Research Concepts (primary)1000 |
ChildOf | ![]() | 808 | 2010 Top 25 - Weaknesses On the Cusp | Weaknesses in the 2010 CWE/SANS Top 25 Most Dangerous Programming Errors (primary)800 |
CanPrecede | ![]() | 89 | Improper Sanitization of Special Elements used in an SQL Command ('SQL Injection') | Research Concepts1000 |
CanPrecede | ![]() | 98 | Improper Control of Filename for Include/Require Statement in PHP Program ('PHP File Inclusion') | Research Concepts1000 |
CanPrecede | ![]() | 120 | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | Research Concepts1000 |
ParentOf | ![]() | 457 | Use of Uninitialized Variable | Development Concepts (primary)699 Research Concepts (primary)1000 |
CanAlsoBe | ![]() | 454 | External Initialization of Trusted Variables or Data Stores | Research Concepts1000 |
It is highly likely that a large number of resultant weaknesses have missing initialization as a primary factor, but researcher reports generally do not provide this level of detail. |
Submissions | ||||
---|---|---|---|---|
Submission Date | Submitter | Organization | Source | |
PLOVER | Externally Mined | |||
Modifications | ||||
Modification Date | Modifier | Organization | Source | |
2008-07-01 | Sean Eidemiller | Cigital | External | |
added/updated demonstrative examples | ||||
2008-07-01 | Eric Dalci | Cigital | External | |
updated Potential Mitigations, Time of Introduction | ||||
2008-09-08 | CWE Content Team | MITRE | Internal | |
updated Relationships, Other Notes, Taxonomy Mappings |