---
title: "CWE-323: Reusing a Nonce, Key Pair in Encryption"
url: https://radicalnotion.ai/cwe/cwe-323
type: cwe
description: "Nonces should be used for the present occasion and only once."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-323: Reusing a Nonce, Key Pair in Encryption

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

## Description

Nonces should be used for the present occasion and only once.

## Background

Nonces are often bundled with a key in a communication exchange to produce a new session key for each exchange.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Architecture and Design | REALIZATION: This weakness is caused during implementation of an architectural security tactic. |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Access Control | Bypass Protection Mechanism, Gain Privileges or Assume Identity | Potentially a replay attack, in which an attacker could send the same data twice, could be crafted if nonces are allowed to be reused. This could allow a user to send a message which masquerades as a valid message from a valid user. |

## Potential mitigations

### Implementation

Refuse to reuse nonce values.

### Implementation

Use techniques such as requiring incrementing, time based and/or challenge response to assure uniqueness of nonces.

## Detection methods

### Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

## Demonstrative examples

### Example 1

This code takes a password, concatenates it with a nonce, then encrypts it before sending over a network:

Bad code:

```c
void encryptAndSendPassword(char *password){
    char *nonce = "bad";
    ...
    char *data = (unsigned char*)malloc(20);
    int para_size = strlen(nonce) + strlen(password);
    char *paragraph = (char*)malloc(para_size);
    SHA1((const unsigned char*)paragraph,parsize,(unsigned char*)data);
    sendEncryptedData(data)
}
```

Because the nonce used is always the same, an attacker can impersonate a trusted party by intercepting and resending the encrypted password. This attack avoids the need to learn the unencrypted password.

### Example 2

This code sends a command to a remote server, using an encrypted password and nonce to prove the command is from a trusted party:

Bad code:

```c++
String command = new String("some command to execute");
MessageDigest nonce = MessageDigest.getInstance("SHA");
nonce.update(String.valueOf("bad nonce"));
byte[] nonce = nonce.digest();
MessageDigest password = MessageDigest.getInstance("SHA");
password.update(nonce + "secretPassword");
byte[] digest = password.digest();
sendCommand(digest, command)
```

Once again the nonce used is always the same. An attacker may be able to replay previous legitimate commands or execute new arbitrary commands.

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2024-36289 | social networking app reuses a nonce/key pair, allowing MITM attackers to manipulate direct messages |
| CVE-2024-21530 | Rust package reuses a nonce/key pair when an object is cloned, which resets the random number generation |

## Real CVEs with this weakness (sample of 12 of 50)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2025-59870 | Improper management of a static JWT signing secret in the web application, where the secret lacks rotation , introducing a security risk | critical | 9.8 | - | No | 2026-01-16 |
| CVE-2017-7902 | Reusing a Nonce, Key Pair in Encryption in Rockwell Automation Allen-Bradley MicroLogix 1100 and 1400 | critical | 9.8 | - | No | 2017-06-30 |
| CVE-2026-59099 | Apereo CAS 7.3.0 \< 8.0.0-RC6 - AES-GCM Nonce Reuse Information Disclosure | critical | 9.3 | - | No | 2026-07-02 |
| CVE-2026-49952 | Discuz! X5.0 Authentication Bypass via dbbak.php Encryption Oracle | critical | 9.3 | - | No | 2026-06-15 |
| CVE-2026-115407 | github.com/eclipse-keypont/crypto11/v2: github.com/eclipse-keypont/crypto11: github.com/ThalesGroup/crypto11: github.com/ThalesIgnite/crypto11: crypto11: Information disclosure via missing GCM nonce validation | critical | 9.1 | - | No | 2026-11-20 |
| CVE-2026-12205 | Crypt::DSA versions before 1.21 for Perl reused the nonce across signatures, leading to private-key recovery | critical | 9.1 | - | No | 2026-06-15 |
| CVE-2025-64767 | hpke-js reuses AEAD nonces | critical | 9.1 | - | No | 2025-11-21 |
| CVE-2019-7593 | Metasys use of shared RSA key pairs | critical | 9.1 | - | No | 2019-08-20 |
| CVE-2022-24401 | Keystream recovery for arbitrary frames in TETRA | high | 8.8 | - | No | 2023-10-19 |
| CVE-2026-25998 | strongMan vulnerable to private credential recovery due to key and counter reuse | high | 8.7 | - | No | 2026-02-19 |
| CVE-2026-109140 | Krill login-session tokens reuse their encryption nonce across restarts, so any user who can log in can forge an "admin" token | high | 8.4 | - | No | 2026-11-02 |
| CVE-2025-47345 | Reusing a Nonce, Key Pair in Encryption in Automotive Platform | high | 8.4 | - | No | 2026-01-06 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-344](https://radicalnotion.ai/cwe/cwe-344) | Use of Invariant Value in Dynamically Changing Context |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| CLASP | Reusing a nonce, key pair in encryption | - | - |

## Frequently asked questions

### What is CWE-323?

Nonces should be used for the present occasion and only once.

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

50 recorded CVEs are attributed to CWE-323, including CVE-2025-59870, CVE-2017-7902 and CVE-2026-59099.

### How do you prevent CWE-323?

Refuse to reuse nonce values.

### How is CWE-323 detected?

Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

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

Exploiting CWE-323 can lead to: Bypass Protection Mechanism, Gain Privileges or Assume Identity.

### Is CWE-323 actively exploited?

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

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

---

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