CWE-14
Compiler Removal of Code to Clear Buffers
AI Translation Available
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.'
Status
draft
Abstraction
variant
Affected Platforms
C
C++
Compiled
Extended Description
AI Translation
This compiler optimization error occurs when:
1. Secret data are stored in memory.
1. The secret data are scrubbed from memory by overwriting its contents.
1. The source code is compiled using an optimizing compiler, which identifies and removes the function that overwrites the contents as a dead store because the memory is not used subsequently.
Technical Details
AI Translation
Common Consequences
confidentiality
access control
Impacts
read memory
bypass protection mechanism
Detection Methods
black box
white box
Potential Mitigations
Phases:
implementation
build and compilation
architecture and design
Descriptions:
•
If possible, configure your compiler so that it does not remove dead stores.
•
Store the sensitive data in a "volatile" memory location if available.
•
Where possible, encrypt sensitive data that are used by a software system.