826
Nature Type ID Name Page
MemberOf 1013 Encrypt Data 2428
Applicable Platforms
Language : Not Language-Specific (Prevalence = Undetermined)
Likelihood Of Exploit
Low
Common Consequences
Scope Impact Likelihood
Availability DoS: Crash, Exit, or Restart
A program may crash or block if it runs out of random
numbers.
Potential Mitigations
Phase: Implementation
Rather than failing on a lack of random numbers, it is often preferable to wait for more numbers
to be created.
Demonstrative Examples
Example 1:
This code uses a TRNG to generate a unique session id for new connections to a server:
Example Language: C (Bad)
while (1){
if (haveNewConnection()){
if (hwRandom()){
int sessionID = hwRandom();
createNewConnection(sessionID);
} } }
This code does not attempt to limit the number of new connections or make sure the TRNG
can successfully generate a new random number. An attacker may be able to create many new
connections and exhaust the entropy of the TRNG. The TRNG may then block and cause the
program to crash or hang.
MemberOf Relationships
This MemberOf relationships table shows additional CWE Catgeories and Views that reference this
weakness as a member. This information is often useful in understanding where a weakness fits
within the context of external information sources.
Nature Type ID Name Page
MemberOf 861 The CERT Oracle Secure Coding Standard for Java
(2011) Chapter 18 - Miscellaneous (MSC)
844 2370
MemberOf 905 SFP Primary Cluster: Predictability 888 2388
MemberOf 1414 Comprehensive Categorization: Randomness 1400 2543
Notes
Maintenance
As of CWE 4.5, terminology related to randomness, entropy, and predictability can vary widely.
Within the developer and other communities, "randomness" is used heavily. However, within
cryptography, "entropy" is distinct, typically implied as a measurement. There are no commonlyused
definitions, even within standards documents and cryptography papers. Future versions of
CWE will attempt to define these terms and, if necessary, distinguish between them in ways that
CWE Version 4.14
CWE-334: Small Space of Random Values
CWE-334: Small Space of Random Values