The product uses or accesses a resource that has not been initialized.
When a resource has not been properly initialized, the product may behave unexpectedly. This may lead to a crash or invalid memory access, but the consequences vary depending on the type of resource and how it is used within the product.
Threat Mapped score: 1.8
Industry: Finiancial
Threat priority: P4 - Informational (Low)
CVE: CVE-2019-9805
Chain: Creation of the packet client occurs before initialization is complete (CWE-696) resulting in a read from uninitialized memory (CWE-908), causing memory corruption.
CVE: CVE-2008-4197
Use of uninitialized memory may allow code execution.
CVE: CVE-2008-2934
Free of an uninitialized pointer leads to crash and possible code execution.
CVE: CVE-2008-0063
Product does not clear memory contents when generating an error message, leading to information leak.
CVE: CVE-2008-0062
Lack of initialization triggers NULL pointer dereference or double-free.
CVE: CVE-2008-0081
Uninitialized variable leads to code execution in popular desktop application.
CVE: CVE-2008-3688
Chain: Uninitialized variable leads to infinite loop.
CVE: CVE-2008-3475
Chain: Improper initialization leads to memory corruption.
CVE: CVE-2005-1036
Chain: Bypass of access restrictions due to improper authorization (CWE-862) of a user results from an improperly initialized (CWE-909) I/O permission bitmap
CVE: CVE-2008-3597
Chain: game server can access player data structures before initialization has happened leading to NULL dereference
CVE: CVE-2009-2692
Chain: uninitialized function pointers can be dereferenced allowing code execution
CVE: CVE-2009-0949
Chain: improper initialization of memory can lead to NULL dereference
CVE: CVE-2009-3620
Chain: some unprivileged ioctls do not verify that a structure has been initialized before invocation, leading to NULL dereference
N/A
N/A
Phase | Note |
---|---|
Implementation | N/A |
Intro: Here, a boolean initiailized field is consulted to ensure that initialization tasks are only completed once. However, the field is mistakenly set to true during static initialization, so the initialization code is never reached.
private boolean initialized = true; public void someMethod() { if (!initialized) { // perform initialization tasks ... initialized = true; }
Intro: The following code intends to limit certain operations to the administrator only.
Body: If the application is unable to extract the state information - say, due to a database timeout - then the $uid variable will not be explicitly set by the programmer. This will cause $uid to be regarded as equivalent to "0" in the conditional, allowing the original user to perform administrator actions. Even if the attacker cannot directly influence the state data, unexpected errors could cause incorrect privileges to be assigned to a user just by accident.
$username = GetCurrentUser(); $state = GetStateData($username); if (defined($state)) { $uid = ExtractUserID($state); } # do stuff if ($uid == 0) { DoAdminThings(); }
Intro: The following code intends to concatenate a string to a variable and print the string.
Body: This might seem innocent enough, but str was not initialized, so it contains random memory. As a result, str[0] might not contain the null terminator, so the copy might start at an offset other than 0. The consequences can vary, depending on the underlying memory.
char str[20]; strcat(str, "hello world"); printf("%s", str);
Intro: This example will leave test_string in an unknown condition when i is the same value as err_val, because test_string is not initialized (CWE-456). Depending on where this code segment appears (e.g. within a function body), test_string might be random if it is stored on the heap or stack. If the variable is declared in static memory, it might be zero or NULL. Compiler optimization might contribute to the unpredictability of this address.
Body: When the printf() is reached, test_string might be an unexpected address, so the printf might print junk strings (CWE-457). To fix this code, there are a couple approaches to making sure that test_string has been properly set once it reaches the printf(). One solution would be to set test_string to an acceptable default before the conditional:
char *test_string; if (i != err_val) { test_string = "Hello World!"; } printf("%s", test_string);