CWEweakness

CWE-330 Use of Insufficiently Random Values

High Official page ↗
Abstraction
Class
Structure
Simple
Status
Stable
Likelihood of exploit
High
Languages
Go, Not Language-Specific, Python
CWE version
5.0

Description

The product uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.

Common consequences

• Confidentiality, Other: 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. • Access Control, Other: Bypass Protection Mechanism, 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. • Access Control: Bypass Protection Mechanism, Gain Privileges or Assume Identity — 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.

Potential mitigations

• [Architecture and Design] 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. • [Implementation] Consider a PRNG that re-seeds itself as needed from high quality pseudo-random output sources, such as hardware devices. • [Architecture and Design, Requirements] 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").

Detection methods

• Black Box: 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. • Automated Static Analysis - Binary or Bytecode: According to SOAR [REF-1479], the following detection techniques may be useful: Cost effective for partial coverage: • Bytecode Weakness Analysis - including disassembler + source code weakness analysis • Binary Weakness Analysis - including disassembler + source code weakness analysis • Manual Static Analysis - Binary or Bytecode: According to SOAR [REF-1479], the following detection techniques may be useful: Cost effective for partial coverage: • Binary / Bytecode disassembler - then use manual analysis for vulnerabilities & anomalies • Dynamic Analysis with Manual Results Interpretation: According to SOAR [REF-1479], the following detection techniques may be useful: Cost effective for partial coverage: • Man-in-the-middle attack tool • Manual Static Analysis - Source Code: According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: • Focused Manual Spotcheck - Focused manual analysis of source • Manual Source Code Review (not inspections) • Automated Static Analysis - Source Code: According to SOAR [REF-1479], the following detection techniques may be useful: Cost effective for partial coverage: • Source code Weakness Analyzer • Context-configured Source Code Weakness Analyzer • Architecture or Design Review: According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: • Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)

Observed examples

• CVE-2021-3692: PHP framework uses mt_rand() function (Marsenne Twister) when generating tokens • CVE-2020-7010: Cloud application on Kubernetes generates passwords using a weak random number generator based on deployment time. • CVE-2009-3278: Crypto product uses rand() library function to generate a recovery key, making it easier to conduct brute force attacks. • CVE-2009-3238: Random number generator can repeatedly generate the same value. • CVE-2009-2367: Web application generates predictable session IDs, allowing session hijacking. • CVE-2009-2158: Password recovery utility generates a relatively small number of random passwords, simplifying brute force attacks. • CVE-2009-0255: Cryptographic key created with a seed based on the system time. • CVE-2008-5162: Kernel function does not have a good entropy source just after boot. • CVE-2008-4905: Blogging software uses a hard-coded salt when calculating a password hash. • CVE-2008-4929: Bulletin board application uses insufficiently random names for uploaded files, allowing other users to access private files. • CVE-2008-3612: Handheld device uses predictable TCP sequence numbers, allowing spoofing or hijacking of TCP connections. • CVE-2008-2433: Web management console generates session IDs based on the login time, making it easier to conduct session hijacking. • CVE-2008-0166: SSL library uses a weak random number generator that only generates 65,536 unique keys. • 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). • CVE-2008-2020: CAPTCHA implementation does not produce enough different images, allowing bypass using a database of all possible checksums. • CVE-2008-0087: DNS client uses predictable DNS transaction IDs, allowing DNS spoofing. • CVE-2008-0141: Application generates passwords that are based on the time of day.

Related

Attack pattern · CAPEC (3)

  • CAPEC-112 Brute Force attack pattern
  • CAPEC-485 Signature Spoofing by Key Recreation attack pattern
  • CAPEC-59 Session Credential Falsification through Prediction attack pattern

Observed example · CVE (17)

  • CVE-2021-3692 yii2 is vulnerable to Use of Predictable Algorithm in Random Number Generator vulnerability
  • CVE-2020-7010 Elastic Cloud on Kubernetes (ECK) versions prior to 1.1.0 generate passwords using a weak random number generator. vulnerability
  • CVE-2009-3278 The QNAP TS-239 Pro and TS-639 Pro with firmware 2.1.7 0613, 3.1.0 0627, and 3.1.1 0815 use the rand library function to generate a certain… vulnerability
  • CVE-2009-3238 The get_random_int function in drivers/char/random.c in the Linux kernel before 2.6.30 produces insufficiently random numbers, which allows… vulnerability
  • CVE-2009-2367 cgi-bin/makecgi-pro in Iomega StorCenter Pro generates predictable session IDs, which allows remote attackers to hijack active sessions and… vulnerability
  • CVE-2009-2158 account-recover.php in TorrentTrader Classic 1.09 chooses random passwords from an insufficiently large set, which makes it easier for… vulnerability
  • CVE-2009-0255 The System extension Install tool in TYPO3 4.0.0 through 4.0.9, 4.1.0 through 4.1.7, and 4.2.0 through 4.2.3 creates the encryption key… vulnerability
  • CVE-2008-5162 The arc4random function in the kernel in FreeBSD 6.3 through 7.1 does not have a proper entropy source for a short time period immediately… vulnerability
  • CVE-2008-4905 Typo 5.1.3 and earlier uses a hard-coded salt for calculating password hashes, which makes it easier for attackers to guess passwords via a… vulnerability
  • CVE-2008-4929 MyBB (aka MyBulletinBoard) 1.4.2 uses insufficient randomness to compose filenames of uploaded files used as attachments, which makes it… vulnerability
  • CVE-2008-3612 The Networking subsystem in Apple iPod touch 2.0 through 2.0.2, and iPhone 2.0 through 2.0.2, uses predictable TCP initial sequence… vulnerability
  • CVE-2008-2433 The web management console in Trend Micro OfficeScan 7.0 through 8.0, Worry-Free Business Security 5.0, and Client/Server/Messaging Suite… vulnerability
  • CVE-2008-0166 OpenSSL 0.9.8c-1 up to versions before 0.9.8g-9 on Debian-based operating systems uses a random number generator that generates predictable… vulnerability
  • CVE-2008-2108 The GENERATE_SEED macro in PHP 4.x before 4.4.8 and 5.x before 5.2.5, when running on 64-bit systems, performs a multiplication that… vulnerability
  • CVE-2008-2020 The CAPTCHA implementation as used in (1) Francisco Burzi PHP-Nuke 7.0 and 8.1, (2) my123tkShop e-Commerce-Suite (aka 123tkShop) 0.9.1, (3)… vulnerability
  • CVE-2008-0087 The DNS client in Microsoft Windows 2000 SP4, XP SP2, Server 2003 SP1 and SP2, and Vista uses predictable DNS transaction IDs, which allows… vulnerability
  • CVE-2008-0141 actions.php in WebPortal CMS 0.6-beta generates predictable passwords containing only the time of day, which makes it easier for remote… vulnerability

Can precede · CWE (1)

  • CWE-804 Guessable CAPTCHA weakness

Child of · CWE (1)

  • CWE-693 Protection Mechanism Failure weakness

Referenced by CAPEC · weakness (3)

  • CAPEC-112 Brute Force attack pattern
  • CAPEC-485 Signature Spoofing by Key Recreation attack pattern
  • CAPEC-59 Session Credential Falsification through Prediction attack pattern

Referenced by CVE · weakness (420)

  • CVE-2026-106074 A flaw in Node.js `crypto` causes the internal entropy caches used by `crypto.randomUUID()`, `crypto.randomUUIDv7()`, and… vulnerability
  • CVE-2026-46346 The Goobi viewer is a web application that allows digitised material to be displayed in a web browser. vulnerability
  • CVE-2026-46347 The Goobi viewer is a web application that allows digitised material to be displayed in a web browser. vulnerability
  • CVE-2026-55889 XDG Desktop Portal is a desktop integration portal. vulnerability
  • CVE-2026-79981 The DNS stub resolver in subsys/net/lib/dns/resolve.c binds one UDP socket per configured server when the resolver context is initialised… vulnerability
  • CVE-2026-114576 A vulnerability has been found in Linksys RE6250 1.0.04.001. vulnerability
  • CVE-2026-6719 IBM Concert 1.0 through 3.0.0 uses weaker than expected cryptographic algorithms that could allow an attacker to decrypt highly sensitive… vulnerability
  • CVE-2026-12272 The Lightweight Cookie Notice – Cookie Banner for Cookie Consent plugin for WordPress is vulnerable to Sensitive Information Exposure in… vulnerability
  • CVE-2026-63149 Omnispace Agora Project before 26.10.0 contains an insecure randomness vulnerability that allows attackers to predict temporary or default… vulnerability
  • CVE-2026-19735 The RFC 6528 initial-sequence-number implementation in subsys/net/ip/tcp.c derived every TCP ISN from SHA-256(unique_key || four-tuple)… vulnerability
  • CVE-2026-105674 TP-Link Tapo C325WB V2 generates the pre-shared key used by its local media streaming service with a time-seeded pseudo-random number… vulnerability
  • CVE-2026-105786 Joplin is an open source note-taking and to-do application that organises notes and lists into notebooks. vulnerability
  • CVE-2026-76105 Dell Container Storage Modules, versions prior to 1.18.0 contain(s) an Use of Insufficiently Random Values vulnerability. vulnerability
  • CVE-2026-102719 Predictable DTLS HelloVerifyRequest Cookie in NetX Secure vulnerability
  • CVE-2026-92930 OpenEye Apex Network Video Recorder (NVR) firmware 3.2.9.376 uses an administrator password-reset unlock-code design that lacks a… vulnerability
  • CVE-2026-96599 Isotope eCommerce through 2.9.10 derives order identifiers from uniqid() instead of a cryptographically secure source, allowing… vulnerability
  • CVE-2026-80154 All firmware versions of Lantronix SLC8000, SLC9000, EMG8500, EMG7500, SLB882, SLCx-03, and SLCx-02 contain an authentication bypass… vulnerability
  • CVE-2026-94456 Postiz generates security-sensitive credentials using `Math.random()` instead of a cryptographically secure source. vulnerability
  • CVE-2026-92912 AVideo through c3edcc274c389816d434acadac07ee78eaf330c1 uses cryptographically weak uniqid() values for RTMP publish keys in… vulnerability
  • CVE-2026-92913 AVideo through commit c3edcc274c389816d434acadac07ee78eaf330c1 uses a cryptographically weak pseudo-random number generator when creating… vulnerability
  • CVE-2026-19407 Bucket Squatting in Google Cloud Gemini Enterprise Agent Platform SDK for Python versions prior to 1.166.1 allows an attacker to achieve… vulnerability
  • CVE-2026-84606 A privacy issue was addressed with improved handling of identifiers. vulnerability
  • CVE-2026-53939 OpenIDC/cjose is a C library implementing the Javascript Object Signing and Encryption (JOSE). vulnerability
  • CVE-2026-79575 The JWT signing secret in yfexam-exam v2.0 is derived from the username and the current month instead of a random server-side key, making… vulnerability
  • CVE-2026-86187 WWBN AVideo generates passwords for external-login accounts using rand() instead of a cryptographic generator, producing only 31-bit… vulnerability
  • CVE-2026-17274 IBM i 7.6, 7.5, 7.4, and 7.3 could allow a remote authenticated attacker to bypass security restrictions due to predictable server seeds. vulnerability
  • CVE-2026-3416 The API Publisher component previously used a non-cryptographic pseudorandom number generator (PRNG) to create shared secrets for Webhook… vulnerability
  • CVE-2026-66047 ProfilePress (wp-user-avatar) WordPress plugin before 4.17.2 contains an unauthenticated remote code execution vulnerability that allows… vulnerability
  • CVE-2026-81852 Use of Insufficiently Random Values vulnerability in ash-project ash_admin ships a hardcoded, publicly known CSP nonce, defeating… vulnerability
  • CVE-2026-82555 A vulnerability has been found in TOTOLINK N600R 4.3.0cu.7866_B20220506. vulnerability
Show all 420 ›

Referenced by CWE · child of (8)

  • CWE-1204 Generation of Weak Initialization Vector (IV) weakness
  • CWE-1241 Use of Predictable Algorithm in Random Number Generator weakness
  • CWE-331 Insufficient Entropy weakness
  • CWE-334 Small Space of Random Values weakness
  • CWE-335 Incorrect Usage of Seeds in Pseudo-Random Number Generator (PRNG) weakness
  • CWE-338 Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG) weakness
  • CWE-340 Generation of Predictable Numbers or Identifiers weakness
  • CWE-344 Use of Invariant Value in Dynamically Changing Context weakness

Referenced by CWE · has member (2)

  • CWE-1003 Weaknesses for Simplified Mapping of Published Vulnerabilities view
  • CWE-1468 Weaknesses Addressed by the OWASP Golang Secure Coding Practices Guide view

Referenced by OWASP · mapped cwe (2)

  • A04:2025 Cryptographic Failures Top 10 2025
  • A02:2021 Cryptographic Failures Top 10 2021