Tag Archives: Compiler Removal of Code to Clear Buffers

CWE-14 – Compiler Removal of Code to Clear Buffers

Read Time:42 Second

Description

Sensitive memory is cleared according to the source code, but compiler optimizations leave the memory untouched when it is not read from again, aka “dead store removal.”

Modes of Introduction:

– Implementation

 

 

Related Weaknesses

CWE-733

 

Consequences

Confidentiality, Access Control: Read Memory, Bypass Protection Mechanism

This weakness will allow data that has not been cleared from memory to be read. If this data contains sensitive password information, then an attacker can read the password and use the information to bypass protection mechanisms.

 

Potential Mitigations

Phase: Implementation

Description: 

Store the sensitive data in a “volatile” memory location if available.

Phase: Build and Compilation

Description: 

If possible, configure your compiler so that it does not remove dead stores.

Phase: Architecture and Design

Description: 

Where possible, encrypt sensitive data that are used by a software system.

CVE References