COMMON WEAKNESS ENUMERATIONIncomplete

CWE-323

Reusing a Nonce, Key Pair in Encryption

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

Abstraction

Base

Structure

Simple

Likelihood of Exploit

High

Understand the problem

What is the problem?

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

Root cause

How and when does the problem arise?

Lifecycle phase

Architecture and Design

REALIZATION: This weakness is caused during implementation of an architectural security tactic.
Nonces are often bundled with a key in a communication exchange to produce a new session key for each exchange.

Risk

What does successful exploitation lead to?

Bypass Protection MechanismGain Privileges or Assume Identity

Affected security scopes: Access Control

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.

Defence

How is it prevented and fixed?

Implementation

Implementation-phase defence

Detail
Refuse to reuse nonce values.

Implementation

Implementation-phase defence

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

Verification

How is it 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.)