CWE-14 详情

CWE-14

Compiler Removal of Code to Clear Buffers
2006-07-19
00h00 +00:00
Draft
2026-10-28
00h00 +00:00
指定 CWE 通知
随时了解指定 CWE 的变更。
管理通知

名称: 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."

基本信息

引入方式

Array
Build and Compilation

适用平台

编程语言

名称: C (Undetermined)
名称: C++ (Undetermined)
类: Compiled (Undetermined)

架构

类: Not Architecture-Specific (Undetermined)

常见后果

影响范围 影响 可能性
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.

潜在缓解措施

Phases : Implementation
Store the sensitive data in a "volatile" memory location if available.
Phases : Build and Compilation
If possible, configure the compiler so that it does not remove dead stores.
Phases : Architecture and Design
Where possible, encrypt sensitive data that are used by a software system.

检测方法

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.
有效性 : Limited

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.

漏洞映射说明

依据 : This CWE entry is at the Variant level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.
备注 : Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.

参考资料

REF-6

Seven Pernicious Kingdoms: A Taxonomy of Software Security Errors
Katrina Tsipenyuk, Brian Chess, Gary McGraw.
https://cwe.mitre.org/documents/sources/SevenPerniciousKingdoms.pdf

REF-7

Writing Secure Code
Michael Howard, David LeBlanc.
https://www.microsoftpressstore.com/store/writing-secure-code-9780735617223

REF-124

When scrubbing secrets in memory doesn't work
Michael Howard.
https://seclists.org/bugtraq/2002/Nov/48

REF-125

Some Bad News and Some Good News
Michael Howard.
https://learn.microsoft.com/en-us/previous-versions/ms972826(v=msdn.10)

REF-126

GNU GCC: Optimizer Removes Code Necessary for Security
Joseph Wagner.
https://seclists.org/bugtraq/2002/Nov/266

提交记录

名称 组织 日期 发布日期 Version
7 Pernicious Kingdoms 2006-07-19 +00:00 2006-07-19 +00:00 Draft 3

修改记录

名称 组织 日期 备注
Eric Dalci Cigital 2008-07-01 +00:00 updated Time_of_Introduction
CWE Content Team MITRE 2008-09-08 +00:00 updated Relationships, Other_Notes, Taxonomy_Mappings
CWE Content Team MITRE 2008-10-14 +00:00 updated Relationships
CWE Content Team MITRE 2008-11-24 +00:00 updated Applicable_Platforms, Description, Detection_Factors, Other_Notes, Potential_Mitigations, Relationships, Taxonomy_Mappings, Time_of_Introduction
CWE Content Team MITRE 2009-05-27 +00:00 updated Demonstrative_Examples
CWE Content Team MITRE 2010-02-16 +00:00 updated References
CWE Content Team MITRE 2011-06-01 +00:00 updated Common_Consequences
CWE Content Team MITRE 2011-09-13 +00:00 updated Relationships, Taxonomy_Mappings
CWE Content Team MITRE 2012-05-11 +00:00 updated Common_Consequences, References, Relationships
CWE Content Team MITRE 2014-07-30 +00:00 updated Relationships, Taxonomy_Mappings
CWE Content Team MITRE 2017-01-19 +00:00 updated Relationships
CWE Content Team MITRE 2017-11-08 +00:00 updated References, Relationships, Taxonomy_Mappings
CWE Content Team MITRE 2018-03-27 +00:00 updated References, Type
CWE Content Team MITRE 2020-02-24 +00:00 updated References, Relationships
CWE Content Team MITRE 2023-04-27 +00:00 updated References, Relationships
CWE Content Team MITRE 2023-06-29 +00:00 updated Mapping_Notes
CWE Content Team MITRE 2024-02-29 +00:00 updated Demonstrative_Examples, Description
CWE Content Team MITRE 2025-09-09 +00:00 updated References
CWE Content Team MITRE 2025-12-11 +00:00 updated Applicable_Platforms, Demonstrative_Examples, Detection_Factors, Weakness_Ordinalities
CWE Content Team MITRE 2026-10-28 +00:00 updated Description, Modes_of_Introduction, Potential_Mitigations, References