The product releases a resource such as memory or a file so that it can be made available for reuse, but it does not clear or "zeroize" the information contained in the resource before the product performs a critical state transition or makes the resource available for reuse by other entities.

When resources are released, they can be made available for reuse. For example, after memory is de-allocated, an operating system may make the memory available to another process, or disk space may be reallocated when a file is deleted. As removing information requires time and additional resources, operating systems do not usually clear the previously written information.
Even when the resource is reused by the same process, this weakness can arise when new data is not as large as the old data, which leaves portions of the old data still available. Equivalent errors can occur in other situations where the length of data is variable but the associated data structure is not. If memory is not cleared after use, the information may be read by less trustworthy parties when the memory is reallocated.
This weakness can apply in hardware, such as when a device or system switches between power, sleep, or debug states during normal operation, or when execution changes to different users or privilege levels.

Primary

Implementation

Confidentiality
Read Application Data

Manual Analysis
Write a known pattern into each sensitive location. Trigger the release of the resource or cause the desired state transition to occur. Read data back from the sensitive locations. If the reads are successful, and the data is the same as the pattern that was originally written, the test fails and the product needs to be fixed. Note that this test can likely be automated.
High

Automated Static Analysis
Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
High

Architecture and Design
Implementation
During critical state transitions, information not needed in the next state should be removed or overwritten with fixed patterns (such as all 0's) or random data, before the transition to the next state.
High

Architecture and Design
Implementation
When releasing, de-allocating, or deleting a resource, overwrite its data and relevant metadata with fixed patterns or random data. Be cautious about complex resource types whose underlying representation might be non-contiguous or change at a low level, such as how a file might be split into different chunks on a file system, even though "logical" file positions are contiguous at the application layer. Such resource types might require invocation of special modes or APIs to tell the underlying operating system to perform the necessary clearing, such as SDelete (Secure Delete) on Windows, although the appropriate functionality might not be available at the application layer.
High

This example shows how an attacker can take advantage of an incorrect state transition.

Suppose a device is transitioning from state A to state B. During state A, it can read certain private keys from the hidden fuses that are only accessible in state A but not in state B. The device reads the keys, performs operations using those keys, then transitions to state B, where those private keys should no longer be accessible.

During the transition from A to B, the device does not scrub the memory.

After the transition to state B, even though the private keys are no longer accessible directly from the fuses in state B, they can be accessed indirectly by reading the memory that contains the private keys.
For transition from state A to state B, remove information which should not be available once the transition is complete.

The following code calls realloc() on a buffer containing sensitive data:

cleartext_buffer = get_secret();...cleartext_buffer = realloc(cleartext_buffer, 1024);...scrub_memory(cleartext_buffer, 1024);

There is an attempt to scrub the sensitive data from memory, but realloc() is used, so it could return a pointer to a different part of memory. The memory that was originally allocated for cleartext_buffer could still contain an uncleared copy of the data.

The following example code is excerpted from the AES wrapper/interface, aes0_wrapper, module of
one of the AES engines (AES0) in the Hack@DAC'21 buggy OpenPiton System-on-Chip (SoC). Note that
this SoC contains three distinct AES engines. Within this wrapper module, four 32-bit registers are
utilized to store the message intended for encryption, referred to as p_c[i]. Using the AXI Lite
interface, these registers are filled with the 128-bit message to be encrypted.

module aes0_wrapper #(...)(...);
...
always @(posedge clk_i)

begin

if(~(rst_ni && ~rst_1)) //clear p_c[i] at reset

begin

start <= 0;
p_c[0] <= 0;
p_c[1] <= 0;
p_c[2] <= 0;
p_c[3] <= 0;
...

end

else if(en && we)

case(address[8:3])

0:

start <= reglk_ctrl_i[1] ? start : wdata[0];

1:

p_c[3] <= reglk_ctrl_i[3] ? p_c[3] : wdata[31:0];

2:

p_c[2] <= reglk_ctrl_i[3] ? p_c[2] : wdata[31:0];

3:

p_c[1] <= reglk_ctrl_i[3] ? p_c[1] : wdata[31:0];

4:

p_c[0] <= reglk_ctrl_i[3] ? p_c[0] : wdata[31:0];

...

endcase

end // always @ (posedge wb_clk_i)

endmodule

The above code snippet [REF-1402] illustrates an instance of a vulnerable implementation of the AES
wrapper module, where p_c[i] registers are cleared at reset. Otherwise, p_c[i]registers either
maintain their old values (if reglk_ctrl_i[3]is true) or get filled through the AXI signal wdata. Note
that p_c[i]registers can be read through the AXI Lite interface (not shown in snippet). However,
p_c[i] registers are never cleared after their usage once the AES engine has completed the encryption
process of the message. In a multi-user or multi-process environment, not clearing registers may result
in the attacker process accessing data left by the victim, leading to data leakage or unintentional
information disclosure.
To fix this issue, it is essential to ensure that these internal registers are cleared in a timely manner after
their usage, i.e., the encryption process is complete. This is illustrated below by monitoring the assertion
of the cipher text valid signal, ct_valid [REF-1403].

module aes0_wrapper #(...)(...);
...
always @(posedge clk_i)

begin

if(~(rst_ni && ~rst_1)) //clear p_c[i] at reset

...

else if(ct_valid) //encryption process complete, clear p_c[i]

begin

p_c[0] <= 0;
p_c[1] <= 0;
p_c[2] <= 0;
p_c[3] <= 0;

end

else if(en && we)

case(address[8:3])
...
endcase

end // always @ (posedge wb_clk_i)

endmodule

CVE-2019-3733
Cryptography library does not clear heap memory before release
https://www.cve.org/CVERecord?id=CVE-2019-3733

CVE-2003-0001
Ethernet NIC drivers do not pad frames with null bytes, leading to infoleak from malformed packets.
https://www.cve.org/CVERecord?id=CVE-2003-0001

CVE-2003-0291
router does not clear information from DHCP packets that have been previously used
https://www.cve.org/CVERecord?id=CVE-2003-0291

CVE-2005-1406
Products do not fully clear memory buffers when less data is stored into the buffer than previous.
https://www.cve.org/CVERecord?id=CVE-2005-1406

CVE-2005-1858
Products do not fully clear memory buffers when less data is stored into the buffer than previous.
https://www.cve.org/CVERecord?id=CVE-2005-1858

CVE-2005-3180
Products do not fully clear memory buffers when less data is stored into the buffer than previous.
https://www.cve.org/CVERecord?id=CVE-2005-3180

CVE-2005-3276
Product does not clear a data structure before writing to part of it, yielding information leak of previously used memory.
https://www.cve.org/CVERecord?id=CVE-2005-3276

CVE-2002-2077
Memory not properly cleared before reuse.
https://www.cve.org/CVERecord?id=CVE-2002-2077

Memory Management
Networking

Memory

Sensitive Information Uncleared Before Use

MEM03-C
Clear sensitive information stored in reusable resources returned for reuse

SFP23
Exposed Data

Allowed
This CWE entry is at the Base 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.

There is a close association between CWE-226 and CWE-212. The difference is partially that of perspective. CWE-226 is geared towards the final stage of the resource lifecycle, in which the resource is deleted, eliminated, expired, or otherwise released for reuse. Technically, this involves a transfer to a different control sphere, in which the original contents of the resource are no longer relevant. CWE-212, however, is intended for sensitive data in resources that are intentionally shared with others, so they are still active. This distinction is useful from the perspective of the CWE research view (CWE-1000).
This entry needs modification to clarify the differences with CWE-212. The description also combines two problems that are distinct from the CWE research perspective: the inadvertent transfer of information to another sphere, and improper initialization/shutdown. Some of the associated taxonomy mappings reflect these different uses.
This is frequently found for network packets, but it can also exist in local memory allocation, files, etc.

PLOVER
2006-07-19
Draft 3
2006-07-19

Eric Dalci
Cigital
2008-07-01
updated Time_of_Introduction

CWE Content Team
MITRE
2008-09-08
updated Relationships, Other_Notes, Relationship_Notes, Taxonomy_Mappings, Weakness_Ordinalities

CWE Content Team
MITRE
2008-10-14
updated Relationships

CWE Content Team
MITRE
2008-11-24
updated Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2009-03-10
updated Relationships

CWE Content Team
MITRE
2009-05-27
updated Relationships

CWE Content Team
MITRE
2009-10-29
updated Description, Other_Notes

CWE Content Team
MITRE
2010-02-16
updated Applicable_Platforms, Maintenance_Notes, Relationship_Notes

CWE Content Team
MITRE
2010-09-27
updated Relationships

CWE Content Team
MITRE
2010-12-13
updated Description

CWE Content Team
MITRE
2011-06-01
updated Common_Consequences, Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2011-09-13
updated Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2012-05-11
updated Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2014-07-30
updated Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2017-11-08
updated Causal_Nature, Functional_Areas, Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2020-02-24
updated Applicable_Platforms, Description, Name, Relationships, Time_of_Introduction, Weakness_Ordinalities

CWE Content Team
MITRE
2020-08-20
updated Description, Name, Related_Attack_Patterns, Relationships

CWE Content Team
MITRE
2021-10-28
updated Demonstrative_Examples, Description, Detection_Factors, Maintenance_Notes, Potential_Mitigations, Relationships, Research_Gaps

CWE Content Team
MITRE
2023-04-27
updated Detection_Factors, Relationships, Time_of_Introduction

CWE Content Team
MITRE
2023-06-29
updated Mapping_Notes

CWE Content Team
MITRE
2024-02-29
4.14
2024-02-29
updated Demonstrative_Examples, Observed_Examples, References

CWE Content Team
MITRE
2025-04-03
4.17
2025-04-03
updated Demonstrative_Examples

CWE Content Team
MITRE
2025-09-09
4.18
2025-09-09
updated Relationships

Rahul Kande, Chen Chen, Jeyavijayan Rajendran
Texas A&M University
2023-11-29
4.14
2024-02-29
suggested demonstrative example

Mohamadreza Rostami, Shaza Zeitouni, Ahmad-Reza Sadeghi
Technical University of Darmstadt
2023-11-29
4.14
2024-02-29
suggested demonstrative example

Sensitive Information Uncleared Before Use
Sensitive Information Uncleared Before Release
Sensitive Information Uncleared in Resource Before Release for Reuse