Skip to main content

CWE-336: Same Seed in Pseudo-Random Number Generator (PRNG)

VariantDraft

A Pseudo-Random Number Generator (PRNG) uses the same seed each time the product is initialized.

View on MITRE
Back to CWE Lookup

Extended Description

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 the attacker may be able to determine the random numbers that will be produced from the PRNG.

Technical Details

Structure
Simple

Applicable To

Languages
Not Language-Specific
Platforms

Frequently Asked Questions

What is CWE-336: Same Seed in Pseudo-Random Number Generator (PRNG)?+

CWE-336: Same Seed in Pseudo-Random Number Generator (PRNG) is a Common Weakness Enumeration (CWE) entry maintained by MITRE. A Pseudo-Random Number Generator (PRNG) uses the same seed each time the product is initialized. 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 the attacker may be able to determine the random numbers that will be produced from the PRNG.

What are the security consequences of Same Seed in Pseudo-Random Number Generator (PRNG)?+

If exploited, CWE-336 (Same Seed in Pseudo-Random Number Generator (PRNG)) it can compromise Other and Access Control, leading to outcomes such as Other and Bypass Protection Mechanism.

How do you prevent or mitigate Same Seed in Pseudo-Random Number Generator (PRNG)?+

Recommended mitigations for CWE-336 include: 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.

Which programming languages are affected by Same Seed in Pseudo-Random Number Generator (PRNG)?+

CWE-336 commonly affects Not Language-Specific. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What are real-world examples of Same Seed in Pseudo-Random Number Generator (PRNG)?+

MITRE documents real CVEs mapped to CWE-336, including CVE-2022-39218. You can look up the full details of each CVE, including CVSS scores and remediation guidance, on our CVE Lookup tool.

What is the difference between a CWE and a CVE?+

A CWE (Common Weakness Enumeration) like CWE-336 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.

Learn More