1562
Applicable Platforms
Language : C (Prevalence = Undetermined)
Language : C++ (Prevalence = Undetermined)
Common Consequences
Scope Impact Likelihood
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.
Detection Methods
Black Box
This specific weakness is impossible to detect using black box methods. While an analyst could
examine memory to see that it has not been scrubbed, an analysis of the executable would
not be successful. This is because the compiler has already removed the relevant code. Only
the source code shows whether the programmer intended to clear the memory or not, so this
weakness is indistinguishable from others.
White Box
This weakness is only detectable using white box methods (see black box detection factor).
Careful analysis is required to determine if the code is likely to be removed by the compiler.
Potential Mitigations
Phase: Implementation
Store the sensitive data in a "volatile" memory location if available.
Phase: Build and Compilation
If possible, configure your compiler so that it does not remove dead stores.
Phase: Architecture and Design
Where possible, encrypt sensitive data that are used by a software system.
Demonstrative Examples
Example 1:
CWE Version 4.14
CWE-14: Compiler Removal of Code to Clear Buffers
CWE-14: Compiler Removal of Code to Clear Buffers