---
title: "CWE-1291: Public Key Re-Use for Signing both Debug and Production Code"
url: https://radicalnotion.ai/cwe/cwe-1291
type: cwe
description: "The same public key is used for signing both debug and production code."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-1291: Public Key Re-Use for Signing both Debug and Production Code

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

## Description

The same public key is used for signing both debug and production code.

A common usage of public-key cryptography is to verify the integrity and authenticity of another entity (for example a firmware binary). If a company wants to ensure that its firmware runs only on its own hardware, before the firmware runs, an encrypted hash of the firmware image will be decrypted with the public key and then verified against the now-computed hash of the firmware image. This means that the public key forms the root of trust, which necessitates that the public key itself must be protected and used properly.

During the development phase, debug firmware enables many hardware debug hooks, debug modes, and debug messages for testing. Those debug facilities provide significant, additional views about the firmware's capability and, in some cases, additional capability into the chip or SoC. If compromised, these capabilities could be exploited by an attacker to take full control of the system.

Once the product exits the manufacturing stage and enters production, it is good practice to use a different public key. Debug firmware images are known to leak. With the debug key being reused as the production key, the debug image will also work on the production image. Thus, it will open all the internal, debug capabilities to the attacker.

If a different public key is used for the production image, even if the attacker gains access to the debug firmware image, they will not be able to run it on a production machine. Thus, damage will be limited to the intellectual property leakage resulting from the debug image.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality, Integrity, Availability, Access Control, Accountability, Authentication, Authorization, Non-Repudiation, Other | Read Memory, Modify Memory, Execute Unauthorized Code or Commands, Gain Privileges or Assume Identity, Varies by Context | - |

## Potential mitigations

### Implementation

Use different keys for Production and Debug.

## Detection methods

### Architecture or Design Review

Compare the debug key with the production key to make sure that they are not the same.

Effectiveness: High

### Dynamic Analysis with Manual Results Interpretation

Compare the debug key with the production key to make sure that they are not the same.

Effectiveness: High

## Demonstrative examples

### Example 1

This example illustrates the danger of using the same public key for debug and production.

Bad code:

```other
Suppose the product design requires frugality of silicon real estate. Assume that originally the architecture allows just enough storage for two 2048-bit RSA keys in the fuse: one to be used for debug and the other for production. However, in the meantime, a business decision is taken to make the security future-proof beyond 2030, which means the architecture needs to use the NIST-recommended 3072-bit keys instead of the originally-planned 2048-bit keys. This means that, at most, one key can be fully stored in the fuses, not two. So the product design team decides to use the same public key for debug and production.
```

Informative code:

```other
Increase the storage so that two different keys of the required size can be stored.
```

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2022-1665 | Power: Signed build of Red Hat Enterprise Linux for IBM Power can boot pre-production kernels | high | 8.2 | - | No | 2022-06-21 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-693](https://radicalnotion.ai/cwe/cwe-693) | Protection Mechanism Failure |
| Peer | [CWE-321](https://radicalnotion.ai/cwe/cwe-321) | Use of Hard-coded Cryptographic Key |

## Frequently asked questions

### What is CWE-1291?

The same public key is used for signing both debug and production code.

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

1 recorded CVE is attributed to CWE-1291: CVE-2022-1665.

### How do you prevent CWE-1291?

Use different keys for Production and Debug.

### How is CWE-1291 detected?

Architecture or Design Review: Compare the debug key with the production key to make sure that they are not the same.

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

Exploiting CWE-1291 can lead to: Read Memory, Modify Memory, Execute Unauthorized Code or Commands, Gain Privileges or Assume Identity, Varies by Context.

### Is CWE-1291 actively exploited?

1 recorded CVE is caused by CWE-1291; it is not currently in CISA's KEV catalog of actively exploited flaws.

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

---

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