---
title: "CWE-1304: Improperly Preserved Integrity of Hardware Configuration State During a Power Save/Restore Operation"
url: https://radicalnotion.ai/cwe/cwe-1304
type: cwe
description: "The product performs a power save/restore operation, but it does not ensure that the integrity of the configuration state is maintained and/or verified between the beginning and ending of the operation."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-1304: Improperly Preserved Integrity of Hardware Configuration State During a Power Save/Restore Operation

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

## Description

The product performs a power save/restore operation, but it does not ensure that the integrity of the configuration state is maintained and/or verified between the beginning and ending of the operation.

## Background

Before powering down, the Intellectual Property (IP) saves current state (S) to persistent storage such as flash or always-on memory in order to optimize the restore operation.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Architecture and Design | Weakness introduced via missing internal integrity guarantees during power save/restore |
| Integration | Weakness introduced via missing external integrity verification during power save/restore |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality, Integrity | DoS: Instability, DoS: Crash, Exit, or Restart, DoS: Resource Consumption (Other), Gain Privileges or Assume Identity, Bypass Protection Mechanism, Alter Execution Logic, Quality Degradation, Unexpected State, Reduce Maintainability, Reduce Performance, Reduce Reliability | - |

## Potential mitigations

### Architecture and Design

Inside the IP, incorporate integrity checking on the configuration state via a cryptographic hash. The hash can be protected inside the IP such as by storing it in internal registers which never lose power. Before powering down, the IP performs a hash of the configuration and saves it in these persistent registers. Upon restore, the IP performs a hash of the saved configuration and compares it with the saved hash. If they do not match, then the IP should not trust the configuration.

### Integration

Outside the IP, incorporate integrity checking of the configuration state via a trusted agent. Before powering down, the trusted agent performs a hash of the configuration and saves the hash in persistent storage. Upon restore, the IP requests the trusted agent validate its current configuration. If the configuration hash is invalid, then the IP should not trust the configuration.

### Integration

Outside the IP, incorporate a protected environment that prevents undetected modification of the configuration state by untrusted agents. Before powering down, a trusted agent saves the IP's configuration state in this protected location that only it is privileged to. Upon restore, the trusted agent loads the saved state into the IP.

## Demonstrative examples

### Example 1

The following pseudo code demonstrates the power save/restore workflow which may lead to weakness through a lack of validation of the config state after restore.

Bad code:

```c
void save_config_state()
{
    void* cfg;

    cfg = get_config_state();
    save_config_state(cfg);

    go_to_sleep();
}

void restore_config_state()
{
    void* cfg;
    cfg = get_config_file();
    load_config_file(cfg);
}
```

Good code:

```c
void save_config_state()
{
    void* cfg;
    void* sha;

    cfg = get_config_state();
    save_config_state(cfg);

    // save hash(cfg) to trusted location
    sha = get_hash_of_config_state(cfg);
    save_hash(sha);

    go_to_sleep();
}

void restore_config_state()
{
    void* cfg;
    void* sha_1, sha_2;

    cfg = get_config_file();
    // restore hash of config from trusted memory
    sha_1 = get_persisted_sha_value();

    sha_2 = get_hash_of_config_state(cfg);
    if (sha_1 != sha_2)
        assert_error_and_halt();

    load_config_file(cfg);
}
```

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2023-31316 | - | high | 7.1 | - | No | 2026-05-15 |
| CVE-2024-23485 | - | medium | 4.6 | - | No | 2024-07-11 |

## Related attack patterns (CAPEC)

- [CAPEC-176](https://radicalnotion.ai/capec/capec-176): Configuration/Environment Manipulation

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-284](https://radicalnotion.ai/cwe/cwe-284) | Improper Access Control |
| Peer | [CWE-345](https://radicalnotion.ai/cwe/cwe-345) | Insufficient Verification of Data Authenticity |
| Peer | [CWE-1271](https://radicalnotion.ai/cwe/cwe-1271) | Uninitialized Value on Reset for Registers Holding Security Settings |

## Frequently asked questions

### What is CWE-1304?

The product performs a power save/restore operation, but it does not ensure that the integrity of the configuration state is maintained and/or verified between the beginning and ending of the operation.

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

2 recorded CVEs are attributed to CWE-1304, including CVE-2023-31316 and CVE-2024-23485.

### How do you prevent CWE-1304?

Inside the IP, incorporate integrity checking on the configuration state via a cryptographic hash. The hash can be protected inside the IP such as by storing it in internal registers which never lose power. Before powering down, the IP performs a hash of the configuration and saves it in these persistent registers. Upon restore, the IP performs a hash of the saved configuration and compares it with the saved hash. If they do not match, then the IP should not trust the configuration.

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

Exploiting CWE-1304 can lead to: DoS: Instability, DoS: Crash, Exit, or Restart, DoS: Resource Consumption (Other), Gain Privileges or Assume Identity, Bypass Protection Mechanism, Alter Execution Logic.

### Is CWE-1304 actively exploited?

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

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

---

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