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.
Strategy: Libraries or Frameworks Use products or modules that conform to FIPS 140-2 [ REF-267 ] to avoid obvious entropy problems. Consult FIPS 140-2 Annex C ("Approved Random Number Generators").
No detection method information available for this CWE.
No examples or observed CVEs available for this CWE.
CWE-330: CWE-330: Use of Insufficiently Random Values is a Common Weakness Enumeration (CWE) entry maintained by MITRE. Description
If exploited, CWE-330 (CWE-330: Use of Insufficiently Random Values) it can compromise Other, Bypass Protection Mechanism and Gain Privileges or Assume Identity, leading to outcomes such as Scope: 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., Scope: Access Control and Other If product relies on unique.
Recommended mitigations for CWE-330 include: 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. Strategy: Libraries or Frameworks Use products or modules that conform to FIPS 140-2 [ REF-267 ] to avoid obvious entropy problems. Consult FIPS 140-2 Annex C ("Approved Random Number Generators").
CWE-330 commonly affects Languages. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.
A CWE (Common Weakness Enumeration) like CWE-330 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.