---
title: "CWE-1239: Improper Zeroization of Hardware Register"
url: https://radicalnotion.ai/cwe/cwe-1239
type: cwe
description: "The hardware product does not properly clear sensitive information from built-in registers when the user of the hardware block changes."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-1239: Improper Zeroization of Hardware Register

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

## Description

The hardware product does not properly clear sensitive information from built-in registers when the user of the hardware block changes.

## Background

Hardware logic operates on data stored in registers local to the hardware block. Most hardware IPs, including cryptographic accelerators, rely on registers to buffer I/O, store intermediate values, and interface with software. The result of this is that sensitive information, such as passwords or encryption keys, can exist in locations that are not transparent to the user of the hardware logic.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Architecture and Design | Lack of hardware mechanisms to zeroize or clear registers in the design or specification. |
| Implementation | Mechanisms to zeroize and clear registers are in the design but implemented incorrectly. |
| Operation | Hardware-provided zeroization mechanisms are not used appropriately by the IP user (ex. firmware), or data remanence issues are not taken into account. |

## Applicable platforms

**Technologies:** System on Chip (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality | Varies by Context | The consequences will depend on the information disclosed due to the vulnerability. When a different entity obtains access to the IP due to a change in operating mode or conditions, the new entity can extract information belonging to the previous user if no mechanisms are in place to clear register contents. |

## Potential mitigations

### Architecture and Design

It is important to clear information stored in the hardware if a physical attack on the product is detected, or if the user of the hardware block changes. Every register potentially containing sensitive information must have a policy specifying how and when information is cleared, in addition to clarifying if it is the responsibility of the hardware logic or IP user to initiate the zeroization procedure at the appropriate time.

## Demonstrative examples

### Example 1

Suppose a hardware IP for implementing an encryption routine works as expected, but it leaves the intermediate results in some registers that can be accessed. Exactly why this access happens is immaterial - it might be unintentional or intentional, where the designer wanted a "quick fix" for something.

### Example 2

The example code below \[REF-1379\] is taken from the SHA256 Interface/wrapper controller module of the HACK@DAC'21 buggy OpenPiton SoC. Within the wrapper module there are a set of 16 memory-mapped registers referenced data\[0\] to data\[15\]. These registers are 32 bits in size and are used to store the data received on the AXI Lite interface for hashing. Once both the message to be hashed and a request to start the hash computation are received, the values of these registers will be forwarded to the underlying SHA256 module for processing. Once forwarded, the values in these registers no longer need to be retained. In fact, if not cleared or overwritten, these sensitive values can be read over the AXI Lite interface, potentially compromising any previously confidential data stored therein.

Bad code:

```systemverilog
...
    // Implement SHA256 I/O memory map interface
    // Write side
    always @(posedge clk_i)
        begin
            if(~(rst_ni && ~rst_3))
                begin
                    startHash <= 0;
                    newMessage <= 0;
                    data[0] <= 0;
                    data[1] <= 0;
                    data[2] <= 0;
                    ...
                    data[14] <= 0;
                    data[15] <= 0;
...
```

Good code:

```systemverilog
...
    // Implement SHA256 I/O memory map interface
    // Write side
    always @(posedge clk_i)
        begin
            if(~(rst_ni && ~rst_3))
                begin
                    startHash <= 0;
                    newMessage <= 0;
                    data[0] <= 0;
                    data[1] <= 0;
                    data[2] <= 0;
                    ...
                    data[14] <= 0;
                    data[15] <= 0;
                end
            else if(hashValid && ~hashValid_r)
                begin
                    data[0] <= 0;
                    data[1] <= 0;
                    data[2] <= 0;
                    ...
                    data[14] <= 0;
                    data[15] <= 0;
                end
...
```

## Related attack patterns (CAPEC)

- [CAPEC-150](https://radicalnotion.ai/capec/capec-150): Collect Data from Common Resource Locations
- [CAPEC-204](https://radicalnotion.ai/capec/capec-204): Lifting Sensitive Data Embedded in Cache
- [CAPEC-37](https://radicalnotion.ai/capec/capec-37): Retrieve Embedded Sensitive Data
- [CAPEC-545](https://radicalnotion.ai/capec/capec-545): Pull Data from System Resources

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-1272](https://radicalnotion.ai/cwe/cwe-1272) | Sensitive Information Uncleared Before Debug/Power State Transition |
| Can also be | [CWE-1258](https://radicalnotion.ai/cwe/cwe-1258) | Exposure of Sensitive System Information Due to Uncleared Debug Information |

## Frequently asked questions

### What is CWE-1239?

The hardware product does not properly clear sensitive information from built-in registers when the user of the hardware block changes.

### How do you prevent CWE-1239?

It is important to clear information stored in the hardware if a physical attack on the product is detected, or if the user of the hardware block changes. Every register potentially containing sensitive information must have a policy specifying how and when information is cleared, in addition to clarifying if it is the responsibility of the hardware logic or IP user to initiate the zeroization procedure at the appropriate time.

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

Exploiting CWE-1239 can lead to: Varies by Context.

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

---

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