CWE-323 Base Incomplete High likelihood

Reusing a Nonce, Key Pair in Encryption

This vulnerability occurs when a cryptographic nonce or key pair is reused, compromising the security of the encrypted data.

Definition

What is CWE-323?

This vulnerability occurs when a cryptographic nonce or key pair is reused, compromising the security of the encrypted data.
In cryptography, a nonce (number used once) is a random or pseudo-random value that should be used for a single encryption session or transaction. Reusing it, or reusing the same key pair in a similar context, can allow attackers to decrypt messages, forge authentication, or break the encryption scheme entirely. This fundamentally undermines the security guarantees that modern encryption is designed to provide. To prevent this, developers must ensure nonces and ephemeral key pairs are generated uniquely for every single operation. Implement systems that securely manage state to guarantee no value is repeated, and prefer using well-vetted cryptographic libraries that handle this automatically, rather than attempting custom implementations.
Auswirkungen in der Praxis

Real-world CVEs caused by CWE-323

Bisher sind in MITREs Katalog keine öffentlichen CVE-Referenzen mit dieser CWE verknüpft.

Wie Angreifer es ausnutzen

Angreiferpfad Schritt für Schritt

  1. 1

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

  2. 2

    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.

  3. 3

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

  4. 4

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

Verwundbares Codebeispiel

Vulnerable C

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

Verwundbar 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)
  }
Sicheres Codebeispiel

Secure pseudo

Sicher pseudo
// Validate, sanitize, or use a safe API before reaching the sink.
function handleRequest(input) {
  const safe = validateAndEscape(input);
  return executeWithGuards(safe);
}
What changed: the unsafe sink is replaced (or the input is validated/escaped) so the same payload no longer triggers the weakness.
Präventions-Checkliste

How to prevent CWE-323

  • Implementation Refuse to reuse nonce values.
  • Implementation Use techniques such as requiring incrementing, time based and/or challenge response to assure uniqueness of nonces.
Erkennungssignale

How to detect CWE-323

SAST High

Führe statische Analyse (SAST) auf der Codebasis aus und suche im Datenfluss nach dem unsicheren Muster.

DAST Moderate

Führe dynamische Application-Security-Tests gegen den Live-Endpoint aus.

Runtime Moderate

Beobachte Runtime-Logs auf ungewöhnliche Exception-Traces, fehlerhafte Eingaben oder Versuche, Autorisierung zu umgehen.

Code review Moderate

Code Review: Markiere jeden neuen Code, der Eingaben von dieser Oberfläche ohne validierte Framework-Helper verarbeitet.

Plexicus Auto-Fix

Plexicus erkennt CWE-323 automatisch und öffnet in unter 60 Sekunden einen Fix-PR.

Codex Remedium scannt jeden Commit, identifiziert genau diese Schwachstelle und liefert einen reviewer-ready Pull Request mit dem Patch. Keine Tickets. Keine Hand-offs.

Häufig gestellte Fragen

Frequently asked questions

Was ist CWE-323?

This vulnerability occurs when a cryptographic nonce or key pair is reused, compromising the security of the encrypted data.

Wie gravierend ist CWE-323?

MITRE stuft die Exploit-Wahrscheinlichkeit als hoch ein — diese Schwachstelle wird aktiv in freier Wildbahn ausgenutzt und sollte priorisiert behoben werden.

Welche Sprachen oder Plattformen sind von CWE-323 betroffen?

MITRE hat für diese CWE keine betroffenen Plattformen spezifiziert — sie kann in den meisten Anwendungs-Stacks auftreten.

Wie kann ich CWE-323 verhindern?

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

Wie erkennt und behebt Plexicus CWE-323?

Die SAST-Engine von Plexicus erkennt die Datenfluss-Signatur von CWE-323 bei jedem Commit. Bei einem Treffer öffnet unser Codex-Remedium-Agent einen Fix-PR mit korrigiertem Code, Tests und einer einzeiligen Zusammenfassung für den Reviewer.

Wo erfahre ich mehr über CWE-323?

MITRE veröffentlicht die kanonische Definition unter https://cwe.mitre.org/data/definitions/323.html. Für ergänzende Hinweise kannst du auch die OWASP- und NIST-Dokumentation heranziehen.

Bereit, wenn du es bist

Schluss mit dem Bezahlen pro Entwickler.
Schließ den Kreislauf.

Plexicus ist die KI-native ASPM, die scannt, filtert, fixt, pentestet und erklärt — autonom. Unbegrenzte Entwickler, unbegrenzte Repos, Fair-Use-KI-Aktionen. Echter kostenloser Tarif, €269/mo jährlich, wenn du bereit bist.