CWEweakness
CWE-336 Same Seed in Pseudo-Random Number Generator (PRNG)
- Abstraction
- Variant
- Structure
- Simple
- Status
- Draft
- Languages
- Not Language-Specific
- CWE version
- 5.0
Description
The product uses a Pseudo-Random Number Generator (PRNG) that uses the same seed each time the product is initialized.
Common consequences
• Other, Access Control: Varies by Context, Bypass Protection Mechanism — Given the deterministic nature of PRNGs, using the same seed for each initialization will lead to the same output in the same order. If an attacker can guess (or knows) the seed, then they may be able to determine the random numbers that will be produced from the PRNG.
Potential mitigations
• [Architecture and Design] Do not reuse PRNG seeds. Consider a PRNG that periodically re-seeds itself as needed from a high quality pseudo-random output, 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, or use the more recent FIPS 140-3 [REF-1192] if possible.
Detection methods
• 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.)
Observed examples
• CVE-2022-39218: SDK for JavaScript app builder for serverless code uses the same fixed seed for a PRNG, allowing cryptography bypass
Related
Observed example · CVE (1)
- CVE-2022-39218 The JS Compute Runtime for Fastly's Compute@Edge platform provides the environment JavaScript is executed in when using the Compute@Edge… vulnerability
Child of · CWE (1)
- CWE-335 Incorrect Usage of Seeds in Pseudo-Random Number Generator (PRNG) weakness
Referenced by CVE · weakness (3)
- CVE-2026-6924 A bug in the entropy initialization for SiWx917 causes the DRBG to use a predictable seed. vulnerability
- CVE-2026-24044 Element Server Suite Community Edition (ESS Community) deploys a Matrix stack using the provided Helm charts and Kubernetes distribution. vulnerability
- CVE-2021-42810 A flaw in the previous versions of the product may allow an authenticated attacker the ability to execute code as a privileged user on a… vulnerability