---
title: "CWE-1221: Incorrect Register Defaults or Module Parameters"
url: https://radicalnotion.ai/cwe/cwe-1221
type: cwe
description: "Hardware description language code incorrectly defines register defaults or hardware Intellectual Property (IP) parameters to insecure values."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-1221: Incorrect Register Defaults or Module Parameters

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

## Description

Hardware description language code incorrectly defines register defaults or hardware Intellectual Property (IP) parameters to insecure values.

## Background

Integrated circuits and hardware IP software programmable controls and settings are commonly stored in register circuits. These register contents have to be initialized at hardware reset to defined default values that are hard coded in the hardware description language (HDL) code of the hardware unit. Hardware description languages also support definition of parameter variables, which can be defined in code during instantiation of the hardware IP module. Such parameters are generally used to configure a specific instance of a hardware IP in the design.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | Such issues could be introduced during implementation of hardware design, since IP parameters and defaults are defined in HDL code and identified later during Testing or System Configuration phases. |

## Applicable platforms

**Languages:** Verilog (Undetermined), VHDL (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality, Integrity, Availability, Access Control | Varies by Context | The system security settings of a hardware design can be affected by incorrectly defined default values or IP parameters. The hardware IP would be in an insecure state at power reset, and this can be exposed or exploited by untrusted software running on the system. Degradation of system functionality or loss of access control enforcement can occur. |
| Other | Reduce Maintainability | Both register defaults and parameters are hardcoded values, which cannot be changed using software or firmware patches but must be changed in hardware silicon. Thus, such security issues are considerably more difficult to address later in the lifecycle. |

## Potential mitigations

### Architecture and Design

During hardware design, all the system parameters and register defaults must be reviewed to identify security sensitive settings.

### Implementation

The default values of these security sensitive settings need to be defined as part of the design review phase.

## Detection methods

### Automated Analysis

Use automated tools to test that values are configured per design specifications. Hardware designs can have a large number of such parameters and register defaults settings, and it is important to have design tool support to check these settings in an automated way and be able to identify which settings are security sensitive.

## Demonstrative examples

### Example 1

Consider example design module system verilog code shown below. The register\_example module is an example parameterized module that defines two parameters, REGISTER\_WIDTH and REGISTER\_DEFAULT. Register\_example module defines a Secure\_mode setting, which when set makes the register content read-only and not modifiable by software writes. register\_top module instantiates two registers, Insecure\_Device\_ID\_1 and Insecure\_Device\_ID\_2. Generally, registers containing device identifier values are required to be read only to prevent any possibility of software modifying these values.

Bad code:

```verilog
// Parameterized Register module example
// Secure_mode : REGISTER_DEFAULT[0] : When set to 1 register is read only and not writable//
module register_example
#(
parameter REGISTER_WIDTH = 8, // Parameter defines width of register, default 8 bits
parameter [REGISTER_WIDTH-1:0] REGISTER_DEFAULT = 2**REGISTER_WIDTH -2 // Default value of register computed from Width. Sets all bits to 1s except bit 0 (Secure _mode)
)
(
input [REGISTER_WIDTH-1:0] Data_in,
input Clk,
input resetn,
input write,
output reg [REGISTER_WIDTH-1:0] Data_out
);

reg Secure_mode;

always @(posedge Clk or negedge resetn)
    if (~resetn)
    begin
        Data_out <= REGISTER_DEFAULT; // Register content set to Default at reset
        Secure_mode <= REGISTER_DEFAULT[0]; // Register Secure_mode set at reset
    end
    else if (write & ~Secure_mode)
    begin
        Data_out <= Data_in;
    end
endmodule

module register_top
(
input Clk,
input resetn,
input write,
input [31:0] Data_in,
output reg [31:0] Secure_reg,
output reg [31:0] Insecure_reg
);

register_example #(
    .REGISTER_WIDTH (32),
    .REGISTER_DEFAULT (1224) // Incorrect Default value used bit 0 is 0.
) Insecure_Device_ID_1 (
    .Data_in (Data_in),
    .Data_out (Secure_reg),
    .Clk (Clk),
    .resetn (resetn),
    .write (write)
);

register_example #(
    .REGISTER_WIDTH (32) // Default not defined 2^32-2 value will be used as default.
) Insecure_Device_ID_2 (
    .Data_in (Data_in),
    .Data_out (Insecure_reg),
    .Clk (Clk),
    .resetn (resetn),
    .write (write)
);

endmodule
```

Good code:

```verilog
register_example #(
    .REGISTER_WIDTH (32),
    .REGISTER_DEFAULT (1225) // Correct default value set, to enable Secure_mode
) Secure_Device_ID_example (
    .Data_in (Data_in),
    .Data_out (Secure_reg),
    .Clk (Clk),
    .resetn (resetn),
    .write (write)
);
```

### Example 2

The example code is taken from the fuse memory inside the buggy OpenPiton SoC of HACK@DAC'21 \[REF-1356\]. Fuse memory can be used to store key hashes, password hashes, and configuration information. For example, the password hashes of JTAG and HMAC are stored in the fuse memory in the OpenPiton design.

Bad code:

```systemverilog
parameter  MEM_SIZE = 100;
localparam JTAG_OFFSET = 81;

const logic [MEM_SIZE-1:0][31:0] mem = {
    // JTAG expected HMAC hash
    32'h49ac13af, 32'h1276f1b8, 32'h6703193a, 32'h65eb531b,
    32'h3025ccca, 32'h3e8861f4, 32'h329edfe5, 32'h98f763b4,
...
assign jtag_hash_o = {mem[JTAG_OFFSET-1],mem[JTAG_OFFSET-2],mem[JTAG_OFFSET-3],
mem[JTAG_OFFSET-4],mem[JTAG_OFFSET-5],mem[JTAG_OFFSET-6],mem[JTAG_OFFSET-7],mem[JTAG_OFFSET-8]};
...
```

Good code:

```systemverilog
parameter  MEM_SIZE = 100;
localparam JTAG_OFFSET = 100;
```

### Example 3

The following example code is excerpted from the Access Control module, acct\_wrapper, in the Hack@DAC'21 buggy OpenPiton System-on-Chip (SoC). Within this module, a set of memory-mapped I/O registers, referred to as acct\_mem, each 32-bit wide, is utilized to store access control permissions for peripherals \[REF-1437\]. Access control registers are typically used to define and enforce permissions and access rights for various system resources.

Bad code:

```systemverilog
module acct_wrapper #(
...
    always @(posedge clk_i)
        begin
            if(~(rst_ni && ~rst_6))
                begin
                    for (j=0; j < AcCt_MEM_SIZE; j=j+1)
                        begin
                            acct_mem[j] <= 32'hffffffff;
                        end
                end
        ...
```

Good code:

```systemverilog
module acct_wrapper #(
...
    always @(posedge clk_i)
        begin
            if(~(rst_ni && ~rst_6))
                begin
                    for (j=0; j < AcCt_MEM_SIZE; j=j+1)
                        begin
                            acct_mem[j] <= 32'h00000000;
                        end
                end
        ...
```

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2022-20731 | Cisco Catalyst Digital Building Series Switches and Cisco Catalyst Micro Switches Vulnerabilities | medium | 6.8 | - | No | 2022-04-15 |
| CVE-2022-20661 | Cisco Catalyst Digital Building Series Switches and Cisco Catalyst Micro Switches Vulnerabilities | medium | 4.6 | - | No | 2022-04-15 |

## Related attack patterns (CAPEC)

- [CAPEC-166](https://radicalnotion.ai/capec/capec-166): Force the System to Reset Values

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-1419](https://radicalnotion.ai/cwe/cwe-1419) | Incorrect Initialization of Resource |

## Frequently asked questions

### What is CWE-1221?

Hardware description language code incorrectly defines register defaults or hardware Intellectual Property (IP) parameters to insecure values.

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

2 recorded CVEs are attributed to CWE-1221, including CVE-2022-20731 and CVE-2022-20661.

### How do you prevent CWE-1221?

During hardware design, all the system parameters and register defaults must be reviewed to identify security sensitive settings.

### How is CWE-1221 detected?

Automated Analysis: Use automated tools to test that values are configured per design specifications. Hardware designs can have a large number of such parameters and register defaults settings, and it is important to have design tool support to check these settings in an automated way and be able to identify which settings are security sensitive.

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

Exploiting CWE-1221 can lead to: Varies by Context, Reduce Maintainability.

### Is CWE-1221 actively exploited?

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

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

---

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