CWEweakness
CWE-14 Compiler Removal of Code to Clear Buffers
- Abstraction
- Variant
- Structure
- Simple
- Status
- Draft
- Languages
- C, C++, Compiled
- CWE version
- 5.0
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."
Common 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
• [Implementation] Store the sensitive data in a "volatile" memory location if available.
• [Build and Compilation] If possible, configure the compiler so that it does not remove dead stores.
• [Architecture and Design] Where possible, encrypt sensitive data that are used by a software system.
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.
Related
Child of · CWE (1)
- CWE-733 Compiler Optimization Removal or Modification of Security-critical Code weakness
Referenced by CVE · weakness (10)
- CVE-2026-48984 pam_usb provides hardware authentication for Linux using ordinary removable media. vulnerability
- CVE-2025-64646 IBM Concert 1.0.0 through 2.2.0 could allow an attacker to access sensitive information in memory due to the buffer not properly clearing… vulnerability
- CVE-2023-0965 Compiler removal of buffer clearing in sli_cryptoacc_transparent_key_agreement in Silicon Labs Gecko Platform SDK v4.2.1 and earlier… vulnerability
- CVE-2023-1132 Compiler removal of buffer clearing in sli_se_driver_key_agreement in Silicon Labs Gecko Platform SDK v4.2.1 and earlier results in key… vulnerability
- CVE-2023-2481 Compiler removal of buffer clearing in sli_se_opaque_import_key in Silicon Labs Gecko Platform SDK v4.2.1 and earlier results in key… vulnerability
- CVE-2023-32096 Compiler removal of buffer clearing in sli_crypto_transparent_aead_encrypt_tag in Silicon Labs Gecko Platform SDK v4.2.1 and earlier… vulnerability
- CVE-2023-32097 Compiler removal of buffer clearing in sli_crypto_transparent_aead_decrypt_tag in Silicon Labs Gecko Platform SDK v4.2.1 and earlier… vulnerability
- CVE-2023-32098 Compiler removal of buffer clearing in sli_se_sign_message in Silicon Labs Gecko Platform SDK v4.2.1 and earlier results in key material… vulnerability
- CVE-2023-32099 Compiler removal of buffer clearing in sli_se_sign_hash in Silicon Labs Gecko Platform SDK v4.2.1 and earlier results in key material… vulnerability
- CVE-2023-32100 Compiler removal of buffer clearing in sli_se_driver_mac_compute in Silicon Labs Gecko Platform SDK v4.2.1 and earlier results in key… vulnerability
Referenced by CWE · has member (1)
- CWE-884 CWE Cross-section view