COMMON WEAKNESS ENUMERATIONIncomplete

CWE-908

Use of Uninitialized Resource

The product uses or accesses a resource that has not been initialized.

Abstraction

Base

Structure

Simple

Likelihood of Exploit

Medium

Understand the problem

What is the problem?

The product uses or accesses a resource that has not been initialized.

Extended description

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.

Root cause

How and when does the problem arise?

Lifecycle phase

Implementation

Risk

What does successful exploitation lead to?

Read MemoryRead Application Data

Affected security scopes: Confidentiality

When reusing a resource such as memory or a program variable, the original contents of that resource may not be cleared before it is sent to an untrusted party.
DoS: Crash, Exit, or Restart

Affected security scopes: Availability

The uninitialized resource may contain values that cause program flow to change in ways that the programmer did not intend.

Defence

How is it prevented and fixed?

Implementation

Implementation-phase defence

Detail
Explicitly initialize the resource before use. If this is performed through an API function or standard procedure, follow all required steps.

Implementation

Implementation-phase defence

Detail
Pay close attention to complex conditionals that affect initialization, since some branches might not perform the initialization.

Implementation

Implementation-phase defence

Detail
Avoid race conditions (CWE-362) during initialization routines.

Build and Compilation

Build and Compilation aşaması savunması

Detail
Run or compile the product with settings that generate warnings about uninitialized variables or data.

Verification

How is it detected?

Automated Static Analysis

High
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.)