CWE-330: Use of Insufficiently Random Values
The product uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
Last updated
The product uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
Last updated
CWE-330 (Use of Insufficiently Random Values) is a class-level software weakness catalogued by MITRE in the Common Weakness Enumeration (CWE). It describes a recurring type of mistake that can lead to exploitable security vulnerabilities.
Computers are deterministic machines, and as such are unable to produce true randomness. Pseudo-Random Number Generators (PRNGs) approximate randomness algorithmically, starting with a seed from which subsequent values are calculated. There are two types of PRNGs: statistical and cryptographic. Statistical PRNGs provide useful statistical properties, but their output is highly predictable and forms an easy to reproduce numeric stream that is unsuitable for use in cases where security depends on generated values being unpredictable. Cryptographic PRNGs address this problem by generating output that is more difficult to predict. For a value to be cryptographically secure, it must be impossible or highly improbable for an attacker to distinguish between it and a truly random value.
347 recorded CVEs are caused by CWE-330 (Use of Insufficiently Random Values). The highest-severity and most recent are shown first. 73 new CWE-330 CVEs have been recorded so far in 2026 (22 in 2025).
Use of Insufficiently Random Values in InHand Networks InRouter
Junos OS: vMX series: Predictable IP ID sequence numbers vulnerability
FreeScout's Predictable Authentication Token Enables Account Takeover
PSW Front-end Login & Registration <= 1.12 - Insufficiently Random Values to Unauthenticated Account Takeover/Privilege Escalation via customer_registration Function
MileSight DeviceHub - CWE-330 Use of Insufficiently Random Values
Use of Insufficiently Random Values in github.com/greenpau/caddy-security
Use of Insufficiently Random Values in Multiple Embedded TCP/IP Stacks
Use of Insufficiently Random Values in Multiple Embedded TCP/IP Stacks
Microsoft Azure Kubernetes Service Elevation of Privilege Vulnerability
Combodo iTop's weak password reset token leads to account takeover
kapetan dns Request.cs entropy
Showing 12 of 347 recorded CWE-330 CVEs. Get an alert for each new one, with AI-written analysis and fixes.
Monitor these CVEsWhat can happen when CWE-330 is exploited.
Other
Affects: Confidentiality, Other
When a protection mechanism relies on random values to restrict access to a sensitive resource, such as a session ID or a seed for generating a cryptographic key, then the resource being protected could be accessed by guessing the ID or key.
Bypass Protection Mechanism, Other
Affects: Access Control, Other
If product relies on unique, unguessable IDs to identify a resource, an attacker might be able to guess an ID for a resource that is owned by another user. The attacker could then read the resource, or pre-create a resource with the same ID to prevent the legitimate program from properly sending the resource to the intended user. For example, a product might maintain session information in a file whose name is based on a username. An attacker could pre-create this file for a victim user, then set the permissions so that the application cannot generate the session for the victim, preventing the victim from using the application.
Bypass Protection Mechanism, Gain Privileges or Assume Identity
Affects: Access Control
When an authorization or authentication mechanism relies on random values to restrict access to restricted functionality, such as a session ID or a seed for generating a cryptographic key, then an attacker may access the restricted functionality by guessing the ID or key.
Typically introduced during these phases of the software lifecycle.
Languages
Practical mitigations for CWE-330, grouped by where in the lifecycle they apply.
Use a well-vetted algorithm that is currently considered to be strong by experts in the field, and select well-tested implementations with adequate length seeds.
In general, if a pseudo-random number generator is not advertised as being cryptographically secure, then it is probably a statistical PRNG and should not be used in security-sensitive contexts.
Pseudo-random number generators can produce predictable numbers if the generator is known and the seed can be guessed. A 256-bit seed is a good starting point for producing a "random enough" number.
Consider a PRNG that re-seeds itself as needed from high quality pseudo-random output sources, such as hardware devices.
Use products or modules that conform to FIPS 140-2 [1] to avoid obvious entropy problems. Consult FIPS 140-2 Annex C ("Approved Random Number Generators").
Use monitoring tools that examine the software's process as it interacts with the operating system and the network. This technique is useful in cases when source code is unavailable, if the software was not developed by you, or if you want to verify that the build phase did not introduce any new weaknesses. Examples include debuggers that directly attach to the running process; system-call tracing utilities such as truss (Solaris) and strace (Linux); system activity monitors such as FileMon, RegMon, Process Monitor, and other Sysinternals utilities (Windows); and sniffers and protocol analyzers that monitor network traffic.
Attach the monitor to the process and look for library functions that indicate when randomness is being used. Run the process multiple times to see if the seed changes. Look for accesses of devices or equivalent resources that are commonly used for strong (or weak) randomness, such as /dev/urandom on Linux. Look for library or system calls that access predictable information such as process IDs and system time.
According to SOAR [5], the following detection techniques may be useful:
Cost effective for partial coverage:
Effectiveness: SOAR Partial
According to SOAR [5], the following detection techniques may be useful:
Cost effective for partial coverage:
Effectiveness: SOAR Partial
According to SOAR [5], the following detection techniques may be useful:
Cost effective for partial coverage:
Effectiveness: SOAR Partial
According to SOAR [5], the following detection techniques may be useful:
Highly cost effective:
Effectiveness: High
According to SOAR [5], the following detection techniques may be useful:
Cost effective for partial coverage:
Effectiveness: SOAR Partial
According to SOAR [5], the following detection techniques may be useful:
Highly cost effective:
Effectiveness: High
MITRE examples of the weakness in code.
This code attempts to generate a unique random identifier for a user's session.
Vulnerable example
function generateSessionID($userID){
srand($userID);
return rand();
}The following code uses a statistical PRNG to create a URL for a receipt that remains active for some period of time after a purchase.
Vulnerable example
String GenerateReceiptURL(String baseUrl) {
Random ranGen = new Random();
ranGen.setSeed((new Date()).getTime());
return(baseUrl + ranGen.nextInt(400000000) + ".html");
}This code uses the Random.nextInt() function to generate "unique" identifiers for the receipt pages it generates. Because Random.nextInt() is a statistical PRNG, it is easy for an attacker to guess the strings it generates. Although the underlying design of the receipt system is also faulty, it would be more secure if it used a random number generator that did not produce predictable receipt identifiers, such as a cryptographic PRNG.
The example code is taken from the PRNG inside the buggy OpenPiton SoC of HACK@DAC'21 [7]. The SoC implements a pseudo-random number generator using a Linear Feedback Shift Register (LFSR).
Vulnerable example
reg in_sr, entropy16_valid;
reg [15:0] entropy16;
assign entropy16_o = entropy16;
assign entropy16_valid_o = entropy16_valid;
always @ (*)
begin
in_sr = ^ (poly_i [15:0] & entropy16 [15:0]);
endReal CVEs that MITRE cites as examples of this weakness.
CAPEC attack patterns that exploit this weakness.
Common questions about CWE-330.
Weakness data is sourced from the MITRE CWE catalog (v4.21). CVE associations are aggregated and kept current by RadicalNotion.AI.
Get an alert when a new CWE-330 CVE affects your products, with AI-written analysis and remediation steps.