CWE-331: Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
Last updated
Overview
CWE-331 (Insufficient Entropy) is a base-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.
Real-world CVEs
124 recorded CVEs are caused by CWE-331 (Insufficient Entropy). The highest-severity and most recent are shown first. 34 new CWE-331 CVEs have been recorded so far in 2026 (13 in 2025).
- CVE-2026-13639Critical · CVSS 9.8 · EPSS 52th2026-09-18
- CVE-2026-38447
osTicket 1.18.3 generates API keys using a predictable construction based on MD5 hashing. The use...
Critical · CVSS 9.8 · EPSS 52th2026-08-03 - CVE-2026-34236
Auth0 PHP SDK Insufficient Entropy in Cookie Encryption
Critical · CVSS 9.8 · EPSS 13th2026-04-01 - CVE-2025-47781
Rallly Insufficient Password Login Token Entropy Leads to Account Takeover
Critical · CVSS 9.8 · EPSS 50th2025-05-14 - CVE-2024-36400
nano-id is unable to generate the correct character set
Critical · CVSS 9.8 · EPSS 55th2024-06-04 - CVE-2024-25730Critical · CVSS 9.8 · EPSS 59th2024-02-23
- CVE-2023-49599
WWBN AVideo Insufficient Entropy vulnerbaility
Critical · CVSS 9.8 · EPSS 62th2024-01-10 - CVE-2023-31176
Insufficient entropy vulnerability could lead to authentication bypass
Critical · CVSS 9.8 · EPSS 61th2023-11-30 - CVE-2023-4344
Broadcom RAID Controller web interface is vulnerable to insufficient randomness due to improper use of ssl.rnd to setup CIM connection
Critical · CVSS 9.8 · EPSS 54th2023-08-15 - CVE-2022-43755
Rancher: Non-random authentication token
Critical · CVSS 9.8 · EPSS 78th2023-02-07 - CVE-2022-34294Critical · CVSS 9.8 · EPSS 80th2022-08-15
- CVE-2021-41615Critical · CVSS 9.8 · EPSS 73th2022-08-08
Showing 12 of 124 recorded CWE-331 CVEs. Get an alert for each new one, with AI-written analysis and fixes.
Monitor these CVEsCommon consequences
What can happen when CWE-331 is exploited.
Bypass Protection Mechanism, Other
Affects: Access Control, Other
An attacker could guess the random numbers generated and could gain unauthorized access to a system if the random numbers are used for authentication and authorization.
How it happens
When it is introduced
Typically introduced during these phases of the software lifecycle.
How to prevent it
Practical mitigations for CWE-331, grouped by where in the lifecycle they apply.
Determine the necessary entropy to adequately provide for randomness and predictability. This can be achieved by increasing the number of bits of objects such as keys and seeds.
How to detect it
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.)
Code examples
MITRE examples of the weakness in code.
This code generates a unique random identifier for a user's session.
Vulnerable example
function generateSessionID($userID){
srand($userID);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();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.
Illustrative examples
Real CVEs that MITRE cites as examples of this weakness.
- CVE-2001-0950 — Insufficiently random data used to generate session tokens using C rand(). Also, for certificate/key generation, uses a source that does not block when entropy is low.
- CVE-2008-2108 — Chain: insufficient precision (CWE-1339) in random-number generator causes some zero bits to be reliably generated, reducing the amount of entropy (CWE-331)
Terminology & mappings
Mapped taxonomies
- PLOVER: Insufficient Entropy
- WASC: Brute Force (11)
- CERT C Secure Coding: Properly seed pseudorandom number generators (MSC32-C) — Exact fit
Attack patterns
CAPEC attack patterns that exploit this weakness.
Frequently asked questions
Common questions about CWE-331.
- What is CWE-331?
- The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
- What CVEs are caused by CWE-331?
- 124 recorded CVEs are attributed to CWE-331, including CVE-2026-13639, CVE-2026-38447 and CVE-2026-34236.
- How do you prevent CWE-331?
- Determine the necessary entropy to adequately provide for randomness and predictability. This can be achieved by increasing the number of bits of objects such as keys and seeds.
- How is CWE-331 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.)
- What are the consequences of CWE-331?
- Exploiting CWE-331 can lead to: Bypass Protection Mechanism, Other.
- Is CWE-331 actively exploited?
- 124 recorded CVEs are caused by CWE-331; none are currently in CISA's KEV catalog of actively exploited flaws.
Sources
- [1]Building Secure Software: How to Avoid Security Problems the Right Way (2002)
References
- MITRE CWE definition (CWE-331) (opens in a new tab)
- CWE-331 vulnerabilities on NVD (opens in a new tab)
- Learn: What is a CWE?
Weakness data is sourced from the MITRE CWE catalog (v4.20). CVE associations are aggregated and kept current by RadicalNotion.AI.
Track CWE-331 CVEs
Get an alert when a new CWE-331 CVE affects your products, with AI-written analysis and remediation steps.