---
title: "CWE-1231: Improper Prevention of Lock Bit Modification"
url: https://radicalnotion.ai/cwe/cwe-1231
type: cwe
description: "The product uses a trusted lock bit for restricting access to registers, address regions, or other resources, but the product does not prevent the value of the lock bit from being modified after it has been set."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-1231: Improper Prevention of Lock Bit Modification

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

## Description

The product uses a trusted lock bit for restricting access to registers, address regions, or other resources, but the product does not prevent the value of the lock bit from being modified after it has been set.

## Background

In integrated circuits and hardware intellectual property (IP) cores, device configuration controls are commonly programmed after a device power reset by a trusted firmware or software module (e.g., BIOS/bootloader) and then locked from any further modification. This behavior is commonly implemented using a trusted lock bit. When set, the lock bit disables writes to a protected set of registers or address regions.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Architecture and Design | Such issues could be introduced during hardware architecture and design and identified later during Testing or System Configuration phases. |
| Implementation | Such issues could be introduced during implementation and identified later during Testing or System Configuration phases. |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Access Control | Modify Memory | Design or coding errors in the implementation of the lock bit protection feature may allow the lock bit to be modified or cleared by software after it has been set. Attackers might be able to unlock the system and features that the bit is intended to protect. Registers protected by tje lock bit can be modified even when the lock is set. |

## Potential mitigations

### Architecture and Design, Implementation, Testing

- Security lock bit protections must be reviewed for design inconsistency and common weaknesses.
- Security lock programming flow and lock properties must be tested in pre-silicon and post-silicon testing.

Effectiveness: High

## Detection methods

### Manual Analysis

Set the lock bit. Power cycle the device. Attempt to clear the lock bit. If the information is changed, implement a design fix. Retest. Also, attempt to indirectly clear the lock bit or bypass it.

Effectiveness: High

## Demonstrative examples

### Example 1

Consider the example design below for a digital thermal sensor that detects overheating of the silicon and triggers system shutdown. The system critical temperature limit (CRITICAL\_TEMP\_LIMIT) and thermal sensor calibration (TEMP\_SENSOR\_CALIB) data have to be programmed by firmware, and then the register needs to be locked (TEMP\_SENSOR\_LOCK).

Bad code:

```other
Register  Field description
CRITICAL_TEMP_LIMIT  [31:8] Reserved field; Read only; Default 0[7:0] Critical temp 0-255 Centigrade; Read-write-lock; Default 125
TEMP_SENSOR_CALIB  [31:0] Thermal sensor calibration data. Slope value used to map sensor reading to degrees Centigrade.
TEMP_SENSOR_LOCK  [31:1] Reserved field; Read only; Default 0[0] Lock bit, locks CRITICAL_TEMP_LIMIT and TEMP_SENSOR_CALIB registers; Write-1-once; Default 0
TEMP_HW_SHUTDOWN  [31:2] Reserved field; Read only; Default 0[1] Enable hardware shutdown on critical temperature detection; Read-write; Default 0
CURRENT_TEMP  [31:8] Reserved field; Read only; Default 0[7:0] Current Temp 0-255 Centigrade; Read-only; Default 0
```

Good code:

```other
To fix this weakness, one could change the TEMP_HW_SHUTDOWN field to be locked by TEMP_SENSOR_LOCK.
TEMP_HW_SHUTDOWN  [31:2] Reserved field; Read only; Default 0 [1] Enable hardware shutdown on critical temperature detection; Read-write-Lock; Default 0[0] Locked by TEMP_SENSOR_LOCK
```

In this example, note that if the system heats to critical temperature, the response of the system is controlled by the TEMP\_HW\_SHUTDOWN bit \[1\], which is not lockable. Thus, the intended security property of the critical temperature sensor cannot be fully protected, since software can misconfigure the TEMP\_HW\_SHUTDOWN register even after the lock bit is set to disable the shutdown response.

### Example 2

The following example code is a snippet from the register locks inside the buggy OpenPiton SoC of HACK@DAC'21 \[REF-1350\]. Register locks help prevent SoC peripherals' registers from malicious use of resources. The registers that can potentially leak secret data are locked by register locks.

Bad code:

```systemverilog
always @(posedge clk_i)
    begin
        if(~(rst_ni && ~jtag_unlock && ~rst_9))
            begin
                for (j=0; j < 6; j=j+1) begin
                    reglk_mem[j] <= 'h0;
            end

end
...
```

Good code:

```systemverilog
always @(posedge clk_i)
    begin
        if(~(rst_ni && ~jtag_unlock))
            begin
                for (j=0; j < 6; j=j+1) begin
                    reglk_mem[j] <= 'h0;
            end

end
...
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2017-6283 | chip reset clears critical read/write lock permissions for RSA function |

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2022-42285 | - | high | 7.8 | - | No | 2023-01-13 |
| CVE-2024-36354 | - | high | 7.5 | - | No | 2025-09-06 |
| CVE-2025-52536 | - | medium | 6.7 | - | No | 2026-02-10 |
| CVE-2024-50295 | net: arc: fix the device for dma\_map\_single/dma\_unmap\_single | medium | 5.5 | - | No | 2024-11-19 |

## Related attack patterns (CAPEC)

- [CAPEC-680](https://radicalnotion.ai/capec/capec-680): Exploitation of Improperly Controlled Registers

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-284](https://radicalnotion.ai/cwe/cwe-284) | Improper Access Control |

## Frequently asked questions

### What is CWE-1231?

The product uses a trusted lock bit for restricting access to registers, address regions, or other resources, but the product does not prevent the value of the lock bit from being modified after it has been set.

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

4 recorded CVEs are attributed to CWE-1231, including CVE-2022-42285, CVE-2024-36354 and CVE-2025-52536.

### How is CWE-1231 detected?

Manual Analysis: Set the lock bit. Power cycle the device. Attempt to clear the lock bit. If the information is changed, implement a design fix. Retest. Also, attempt to indirectly clear the lock bit or bypass it.

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

Exploiting CWE-1231 can lead to: Modify Memory.

### Is CWE-1231 actively exploited?

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

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

---

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