---
title: "CWE-226: Sensitive Information in Resource Not Removed Before Reuse"
url: https://radicalnotion.ai/cwe/cwe-226
type: cwe
description: "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."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-226: Sensitive Information in Resource Not Removed Before Reuse

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 52
- **Of those, in CISA KEV:** 0
- **New in 2026:** 32
- **CWE catalog version:** 4.21

## Description

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. Since 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.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality | Read Application Data | - |

## Potential mitigations

### 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.

Effectiveness: 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.

Effectiveness: High

### Implementation

Be careful using vfork() and fork() in security sensitive code. The process state will not be cleaned up and will contain traces of data from past use.

## Detection methods

### 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.

Effectiveness: 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.)

Effectiveness: High

## Demonstrative examples

### Example 1

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

Bad code:

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

### Example 2

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

Bad code:

```c
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.

### Example 3

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.

Bad code:

```systemverilog
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
```

Good code:

```systemverilog
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
```

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\].

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2019-3733 | Cryptography library does not clear heap memory before release |
| CVE-2003-0001 | Ethernet NIC drivers do not pad frames with null bytes, leading to infoleak from malformed packets. |
| CVE-2003-0291 | router does not clear information from DHCP packets that have been previously used |
| CVE-2005-1406 | Products do not fully clear memory buffers when less data is stored into the buffer than previous. |
| CVE-2005-1858 | Products do not fully clear memory buffers when less data is stored into the buffer than previous. |
| CVE-2005-3180 | Products do not fully clear memory buffers when less data is stored into the buffer than previous. |
| CVE-2005-3276 | Product does not clear a data structure before writing to part of it, yielding information leak of previously used memory. |
| CVE-2002-2077 | Memory not properly cleared before reuse. |

## Real CVEs with this weakness (sample of 12 of 52)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-74791 | Scriban before 7.0.0 Authorization Bypass via Stale Include Cache | critical | 9.2 | - | No | 2026-08-16 |
| CVE-2019-25560 | Lyric Video Creator 2.1 Denial of Service via MP3 File | high | 8.7 | - | No | 2026-03-21 |
| CVE-2022-39393 | Wasmtime vulnerable to data leakage between instances in the pooling allocator | high | 8.6 | - | No | 2022-11-10 |
| CVE-2026-119179 | MongoDB Node.js driver: Connection pool desynchronization after operation timeout can expose other user's data | high | 8.3 | - | No | 2026-11-03 |
| CVE-2024-21850 | - | high | 8.3 | - | No | 2024-11-13 |
| CVE-2025-0647 | - | high | 7.9 | - | No | 2026-01-14 |
| CVE-2026-124851 | zstd: Zstandard Information Disclosure via Uninitialized Buffer | high | 7.5 | - | No | 2026-11-23 |
| CVE-2025-13108 | Fixes to common vulnerabilities found in IBM Db2 Merge Backup for Linux, UNIX and Windows | high | 7.5 | - | No | 2026-02-17 |
| CVE-2023-41138 | - | high | 7.5 | - | No | 2023-11-09 |
| CVE-2018-7166 | nodejs: Unintentional exposure of uninitialized memory | high | 7.5 | - | No | 2018-08-21 |
| CVE-2026-5795 | Eclipse Jetty: Early return from the JASPIAuthenticator code can potentially no clear ThreadLocal variables | high | 7.4 | - | No | 2026-04-08 |
| CVE-2026-137511 | Scriban before 7.6.0 State Leakage via TemplateContext.Reset() Tags | high | 7.2 | - | No | 2026-11-26 |

## Related attack patterns (CAPEC)

- [CAPEC-37](https://radicalnotion.ai/capec/capec-37): Retrieve Embedded Sensitive Data

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-212](https://radicalnotion.ai/cwe/cwe-212) | Improper Removal of Sensitive Information Before Storage or Transfer |
| Parent | [CWE-459](https://radicalnotion.ai/cwe/cwe-459) | Incomplete Cleanup |
| Child | [CWE-244](https://radicalnotion.ai/cwe/cwe-244) | Improper Clearing of Heap Memory Before Release |
| Child | [CWE-1272](https://radicalnotion.ai/cwe/cwe-1272) | Sensitive Information Uncleared Before Debug/Power State Transition |
| Child | [CWE-1301](https://radicalnotion.ai/cwe/cwe-1301) | Insufficient or Incomplete Data Removal within Hardware Component |
| Child | [CWE-1342](https://radicalnotion.ai/cwe/cwe-1342) | Information Exposure through Microarchitectural State after Transient Execution |
| Can precede | [CWE-201](https://radicalnotion.ai/cwe/cwe-201) | Insertion of Sensitive Information Into Sent Data |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Sensitive Information Uncleared Before Use | - | - |
| CERT C Secure Coding | Clear sensitive information stored in reusable resources returned for reuse | MEM03-C | - |
| Software Fault Patterns | Exposed Data | SFP23 | - |

## Frequently asked questions

### What is CWE-226?

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.

### What CVEs are caused by CWE-226?

52 recorded CVEs are attributed to CWE-226, including CVE-2026-74791, CVE-2019-25560 and CVE-2022-39393.

### How do you prevent CWE-226?

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.

### How is CWE-226 detected?

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.

### What are the consequences of CWE-226?

Exploiting CWE-226 can lead to: Read Application Data.

### Is CWE-226 actively exploited?

52 recorded CVEs are caused by CWE-226; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/226.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-226). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
