791
Nature Type ID Name Page
MemberOf 1013 Encrypt Data 2428
Relevant to the view "Software Development" (CWE-699)
Nature Type ID Name Page
MemberOf 320 Key Management Errors 2319
Applicable Platforms
Language : Not Language-Specific (Prevalence = Undetermined)
Background Details
Nonces are often bundled with a key in a communication exchange to produce a new session key
for each exchange.
Likelihood Of Exploit
High
Common Consequences
Scope Impact Likelihood
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
Phase: Implementation
Refuse to reuse nonce values.
Phase: Implementation
Use techniques such as requiring incrementing, time based and/or challenge response to assure
uniqueness of nonces.
Demonstrative Examples
Example 1:
This code takes a password, concatenates it with a nonce, then encrypts it before sending over a
network:
Example Language: C (Bad)
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:
CWE Version 4.14
CWE-324: Use of a Key Past its Expiration Date
CWE-324: Use of a Key Past its Expiration Date