CWE - CWE-1231: Improper Prevention of Lock Bit Modification (4.20)
Home > CWE List > CWE-1231: Improper Prevention of Lock Bit Modification (4.20)  
ID

  • Home
  • CWE-1231: Improper Prevention of Lock Bit Modification

    Weakness ID: 1231
    Vulnerability Mapping: ALLOWED This CWE ID may be used to map to real-world vulnerabilities
    Abstraction: Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource.
    View customized information:
    For users who are interested in more notional aspects of a weakness. Example: educators, technical writers, and project/program managers. For users who are concerned with the practical application and details about the nature of a weakness and how to prevent it from happening. Example: tool developers, security researchers, pen-testers, incident response analysts. For users who are mapping an issue to CWE/CAPEC IDs, i.e., finding the most appropriate CWE for a specific issue (e.g., a CVE record). Example: tool developers, security researchers. For users who wish to see all available information for the CWE/CAPEC entry. For users who want to customize what details are displayed.
    ×

    Edit Custom Filter


    + 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.
    + Extended Description

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

    + Common Consequences
    Section HelpThis table specifies different individual consequences associated with the weakness. The Scope identifies the application security area that is violated, while the Impact describes the negative technical impact that arises if an adversary succeeds in exploiting this weakness. The Likelihood provides information about how likely the specific consequence is expected to be seen relative to the other consequences in the list. For example, there may be high likelihood that a weakness will be exploited to achieve a certain impact, but a low likelihood that it will be exploited to achieve a different impact.
    Impact Details

    Modify Memory

    Scope: Access Control

    Likelihood: High
    Registers protected by lock bit can be modified even when lock is set.
    + Potential Mitigations
    Phase(s) Mitigation

    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

    + Relationships
    Section Help This table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined as ChildOf, ParentOf, MemberOf and give insight to similar items that may exist at higher and lower levels of abstraction. In addition, relationships such as PeerOf and CanAlsoBe are defined to show similar weaknesses that the user may want to explore.
    + Relevant to the view "Research Concepts" (View-1000)
    Nature Type ID Name
    ChildOf Pillar Pillar - a weakness that is the most abstract type of weakness and represents a theme for all class/base/variant weaknesses related to it. A Pillar is different from a Category as a Pillar is still technically a type of weakness that describes a mistake, while a Category represents a common characteristic used to group related things. 284 Improper Access Control
    + Relevant to the view "Hardware Design" (View-1194)
    Nature Type ID Name
    MemberOf Category Category - a CWE entry that contains a set of other entries that share a common characteristic. 1199 General Circuit and Logic Design Concerns
    + Modes Of Introduction
    Section HelpThe different Modes of Introduction provide information about how and when this weakness may be introduced. The Phase identifies a point in the life cycle at which introduction may occur, while the Note provides a typical scenario related to introduction during the given phase.
    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.
    + Applicable Platforms
    Section HelpThis listing shows possible areas for which the given weakness could appear. These may be for specific named Languages, Operating Systems, Architectures, Paradigms, Technologies, or a class of such platforms. The platform is listed along with how frequently the given weakness appears for that instance.
    Languages

    Class: Not Language-Specific (Undetermined Prevalence)

    Operating Systems

    Class: Not OS-Specific (Undetermined Prevalence)

    Architectures

    Class: Not Architecture-Specific (Undetermined Prevalence)

    Technologies

    Class: Not Technology-Specific (Undetermined Prevalence)

    + 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)
    Example Language: 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

    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.

    (good code)
    Example Language: 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


    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.

    In the vulnerable code, the reglk_mem is used for locking information. If one of its bits toggle to 1, the corresponding peripheral's registers will be locked. In the context of the HACK@DAC System-on-Chip (SoC), it is pertinent to note the existence of two distinct categories of reset signals.

    First, there is a global reset signal denoted as "rst_ni," which possesses the capability to simultaneously reset all peripherals to their respective initial states.

    Second, we have peripheral-specific reset signals, such as "rst_9," which exclusively reset individual peripherals back to their initial states. The administration of these reset signals is the responsibility of the reset controller module.

    (bad code)
    Example Language: Verilog 
    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
    ...

    In the buggy SoC architecture during HACK@DAC'21, a critical issue arises within the reset controller module. Specifically, the reset controller can inadvertently transmit a peripheral reset signal to the register lock within the user privilege domain.

    This unintentional action can result in the reset of the register locks, potentially exposing private data from all other peripherals, rendering them accessible and readable.

    To mitigate the issue, remove the extra reset signal rst_9 from the register lock if condition. [REF-1351]

    (good code)
    Example Language: Verilog 
    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
    ...


    + Selected Observed Examples

    Note: this is a curated list of examples for users to understand the variety of ways in which this weakness can be introduced. It is not a complete list of all CVEs that are related to this CWE entry.

    Reference Description
    chip reset clears critical read/write lock permissions for RSA function
    + Weakness Ordinalities
    Ordinality Description
    Primary
    (where the weakness exists independent of other weaknesses)
    + Detection Methods
    Method Details

    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

    + Memberships
    Section HelpThis MemberOf Relationships table shows additional CWE Categories and Views that reference this weakness as a member. This information is often useful in understanding where a weakness fits within the context of external information sources.
    Nature Type ID Name
    MemberOf ViewView - a subset of CWE entries that provides a way of examining CWE content. The two main view structures are Slices (flat lists) and Graphs (containing relationships between entries). 1343 Weaknesses in the 2021 CWE Most Important Hardware Weaknesses List
    MemberOf CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. 1372 ICS Supply Chain: OT Counterfeit and Malicious Corruption
    MemberOf CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. 1396 Comprehensive Categorization: Access Control
    MemberOf CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. 1433 2025 MIHW Supplement: Expert Insights
    + Vulnerability Mapping Notes
    Usage ALLOWED
    (this CWE ID may be used to map to real-world vulnerabilities)
    Reason Acceptable-Use

    Rationale

    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.

    Comments

    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.
    + Content History
    + Submissions
    Submission Date Submitter Organization
    2020-01-15
    (CWE 4.0, 2020-02-24)
    Arun Kanuparthi, Hareesh Khattri, Parbati Kumar Manna, Narasimha Kumar V Mangipudi Intel Corporation
    + Contributions
    Contribution Date Contributor Organization
    2023-06-21 Shaza Zeitouni, Mohamadreza Rostami, Pouya Mahmoody, Ahmad-Reza Sadeghi Technical University of Darmstadt
    suggested demonstrative example
    2023-06-21 Rahul Kande, Chen Chen, Jeyavijayan Rajendran Texas A&M University
    suggested demonstrative example
    2021-10-22 Hareesh Khattri Intel Corporation
    provided observed example
    2021-10-20 Narasimha Kumar V Mangipudi Lattice Semiconductor
    reviewed content changes
    + Modifications
    Modification Date Modifier Organization
    2025-09-09
    (CWE 4.18, 2025-09-09)
    CWE Content Team MITRE
    updated Relationships
    2025-04-03
    (CWE 4.17, 2025-04-03)
    CWE Content Team MITRE
    updated Demonstrative_Examples
    2023-10-26
    (CWE 4.13, 2023-10-26)
    CWE Content Team MITRE
    updated Demonstrative_Examples, References
    2023-06-29
    (CWE 4.12, 2023-06-29)
    CWE Content Team MITRE
    updated Mapping_Notes
    2023-04-27
    (CWE 4.11, 2023-04-27)
    CWE Content Team MITRE
    updated Relationships
    2022-04-28
    (CWE 4.7, 2022-04-28)
    CWE Content Team MITRE
    updated Related_Attack_Patterns, Relationships
    2021-10-28
    (CWE 4.6, 2021-10-28)
    CWE Content Team MITRE
    updated Demonstrative_Examples, Description, Detection_Factors, Name, Observed_Examples, Potential_Mitigations, Relationships, Weakness_Ordinalities
    2020-08-20
    (CWE 4.2, 2020-08-20)
    CWE Content Team MITRE
    updated Related_Attack_Patterns
    2020-06-25
    (CWE 4.1, 2020-06-25)
    CWE Content Team MITRE
    updated Demonstrative_Examples
    + Previous Entry Names
    Change Date Previous Entry Name
    2021-10-28 Improper Implementation of Lock Protection Registers
    Page Last Updated: April 30, 2026