CWE•Variant•Draft•20 recent CVEs
CWE-457Use of Uninitialized Variable
Description
The code uses a variable that has not been initialized, leading to unpredictable or unintended results.
In some languages such as C and C++, stack variables are not initialized by default. They generally contain junk data with the contents of stack memory before the function was invoked. An attacker can sometimes control or read these contents. In other languages or conditions, a variable that is not explicitly initialized can be given a default value that has security implications, depending on the logic of the program. The presence of an uninitialized variable can sometimes indicate a typographic error in the code.
Common consequences
- Availability,Integrity,Other→OtherInitial 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 p
- Authorization,Other→OtherStrings that are not initialized are especially dangerous, since many functions expect a null at the end -- and only at the end -- of a string.
Potential mitigations
- ImplementationEnsure that critical variables are initialized before first use [REF-1485].
- Build and CompilationMost compilers will complain about the use of uninitialized variables if warnings are turned on.
- Implementation,OperationWhen 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.
- RequirementsChoose a language that is not susceptible to these issues.
- Architecture and DesignMitigating technologies such as safe string libraries and container abstractions could be introduced.
Related CWEs
Recent CVEs classified under this CWE
CVE-2026-116965.32026-06-09CVE-2026-116684.32026-06-09CVE-2026-112686.52026-06-05CVE-2026-111594.32026-06-04CVE-2026-111416.52026-06-04CVE-2026-111386.52026-06-04CVE-2026-111376.52026-06-04CVE-2026-111236.52026-06-04CVE-2026-111106.52026-06-04CVE-2026-111096.52026-06-04CVE-2026-111046.52026-06-04CVE-2026-111016.52026-06-04CVE-2026-110906.52026-06-04CVE-2026-110896.52026-06-04CVE-2026-110876.52026-06-04CVE-2026-110676.52026-06-04CVE-2026-110646.52026-06-04CVE-2026-110576.52026-06-04CVE-2026-110396.52026-06-04CVE-2026-110336.52026-06-04