CWE-14: Compiler Removal of Code to Clear Buffers
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."
Last updated
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."
Last updated
10 recorded CVEs are caused by CWE-14 (Compiler Removal of Code to Clear Buffers). The highest-severity and most recent are shown first. 2 new CWE-14 CVEs have been recorded so far in 2026.
Key duplication in GSDK
Key duplication in GSDK
Key duplication in GSDK
Key duplication in GSDK
Key duplication in GSDK
Key duplication in GSDK
Key duplication in GSDK
Key duplication in GSDK
Multiple Vulnerabilities in IBM Concert Software
pam_usb: xfree() does not call explicit_bzero — sensitive cryptographic material may linger in freed heap
What can happen when CWE-14 is exploited.
Read Memory, Bypass Protection Mechanism
Affects: Confidentiality, Access Control
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.
Typically introduced during these phases of the software lifecycle.
Languages
Practical mitigations for CWE-14, grouped by where in the lifecycle they apply.
Store the sensitive data in a "volatile" memory location if available.
If possible, configure the compiler so that it does not remove dead stores.
Where possible, encrypt sensitive data that are used by a software system.
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.
Effectiveness: Limited
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.
MITRE examples of the weakness in code.
The following code reads a password from the user, uses the password to connect to a back-end mainframe, and then attempts to scrub the password from memory using memset().
Vulnerable example
void GetData(char *MFAddr) {
char pwd[64];
if (GetPasswordFromUser(pwd, sizeof(pwd))) {
if (ConnectToMainframe(MFAddr, pwd)) {
// Interaction with mainframe
}
}
memset(pwd, 0, sizeof(pwd));
}Common questions about CWE-14.
Weakness data is sourced from the MITRE CWE catalog (v4.21). CVE associations are aggregated and kept current by RadicalNotion.AI.
Get an alert when a new CWE-14 CVE affects your products, with AI-written analysis and remediation steps.