---
title: "CWE-1245: Improper Finite State Machines (FSMs) in Hardware Logic"
url: https://radicalnotion.ai/cwe/cwe-1245
type: cwe
description: "Faulty finite state machines (FSMs) in the hardware logic allow an attacker to put the system in an undefined state, to cause a denial of service (DoS) or gain privileges on the victim's system."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-1245: Improper Finite State Machines (FSMs) in Hardware Logic

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

## Description

Faulty finite state machines (FSMs) in the hardware logic allow an attacker to put the system in an undefined state, to cause a denial of service (DoS) or gain privileges on the victim's system.

The functionality and security of the system heavily depend on the implementation of FSMs. FSMs can be used to indicate the current security state of the system. Lots of secure data operations and data transfers rely on the state reported by the FSM.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Architecture and Design | - |
| Implementation | - |

## Applicable platforms

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

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Availability, Access Control | Unexpected State, DoS: Crash, Exit, or Restart, DoS: Instability, Gain Privileges or Assume Identity | Faulty FSM designs that do not account for all states, either through undefined states (left as don't cares) or through incorrect implementation, might lead an attacker to drive the system into an unstable state from which the system cannot recover without a reset, thus causing a DoS. Depending on what the FSM is used for, an attacker might also gain additional privileges to launch further attacks and compromise the security guarantees. |

## Potential mitigations

### Architecture and Design, Implementation

Define all possible states and handle all unused states through default statements. Ensure that system defaults to a secure state.

Effectiveness: High

## Demonstrative examples

### Example 1

The Finite State Machine (FSM) shown in the "bad" code snippet below assigns the output ("out") based on the value of state, which is determined based on the user provided input ("user\_input").

Bad code:

```verilog
module fsm_1(out, user_input, clk, rst_n);
input [2:0] user_input;
input clk, rst_n;
output reg [2:0] out;
reg [1:0] state;
always @ (posedge clk or negedge rst_n )
    begin
        if (!rst_n)
            state = 3'h0;
        else
        case (user_input)
            3'h0:
            3'h1:
            3'h2:
            3'h3: state = 2'h3;
            3'h4: state = 2'h2;
            3'h5: state = 2'h1;
        endcase
    end
    out <= {1'h1, state};
endmodule
```

Good code:

```verilog
case (user_input)
    3'h0:
    3'h1:
    3'h2:
    3'h3: state = 2'h3;
    3'h4: state = 2'h2;
    3'h5: state = 2'h1;
    default: state = 2'h0;
endcase
```

The case statement does not include a default to handle the scenario when the user provides inputs of 3'h6 and 3'h7. Those inputs push the system to an undefined state and might cause a crash (denial of service) or any other unanticipated outcome.

Adding a default statement to handle undefined inputs mitigates this issue. This is shown in the "Good" code snippet below. The default statement is in bold.

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2024-58311 | Dormakaba Saflok System 6000 Key Generation Cryptographic Weakness | high | 8.7 | - | No | 2025-12-12 |
| CVE-2025-48508 | - | medium | 6.0 | - | No | 2026-02-11 |
| CVE-2024-21853 | kernel: microcode\_ctl: From CVEorg collector | medium | 5.7 | - | No | 2024-11-13 |
| CVE-2024-31068 | kernel: microcode\_ctl: From CVEorg collector | medium | 5.6 | - | No | 2025-02-12 |
| CVE-2024-24968 | microcode\_ctl: Denial of Service | medium | 5.6 | - | No | 2024-09-16 |

## Related attack patterns (CAPEC)

- [CAPEC-74](https://radicalnotion.ai/capec/capec-74): Manipulating State

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-684](https://radicalnotion.ai/cwe/cwe-684) | Incorrect Provision of Specified Functionality |

## Frequently asked questions

### What is CWE-1245?

Faulty finite state machines (FSMs) in the hardware logic allow an attacker to put the system in an undefined state, to cause a denial of service (DoS) or gain privileges on the victim's system.

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

5 recorded CVEs are attributed to CWE-1245, including CVE-2024-58311, CVE-2025-48508 and CVE-2024-21853.

### How do you prevent CWE-1245?

Define all possible states and handle all unused states through default statements. Ensure that system defaults to a secure state.

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

Exploiting CWE-1245 can lead to: Unexpected State, DoS: Crash, Exit, or Restart, DoS: Instability, Gain Privileges or Assume Identity.

### Is CWE-1245 actively exploited?

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

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

---

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