CWE-339: Small Seed Space in PRNG
A Pseudo-Random Number Generator (PRNG) uses a relatively small seed space, which makes it more susceptible to brute force attacks.
Last updated
Overview
PRNGs are entirely deterministic once seeded, so it should be extremely difficult to guess the seed. If an attacker can collect the outputs of a PRNG and then brute force the seed by trying every possibility to see which seed matches the observed output, then the attacker will know the output of any subsequent calls to the PRNG. A small seed space implies that the attacker will have far fewer possible values to try to exhaust all possibilities.
Real-world CVEs
1 recorded CVEs are caused by CWE-339 (Small Seed Space in PRNG). The highest-severity and most recent are shown first. 1 new CWE-339 CVE has been recorded so far in 2026.
Common consequences
What can happen when CWE-339 is exploited.
Varies by Context
Affects: Other
How it happens
When it is introduced
Typically introduced during these phases of the software lifecycle.
How to prevent it
Practical mitigations for CWE-339, grouped by where in the lifecycle they apply.
Use well vetted pseudo-random number generating algorithms with adequate length seeds. 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.
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.
Code examples
Illustrative examples from MITRE showing how the weakness appears in code.
This code grabs some random bytes and uses them for a seed in a PRNG, in order to generate a new cryptographic key.
Vulnerable example
# getting 2 bytes of randomness for the seeding the PRNGSince only 2 bytes are used as a seed, an attacker will only need to guess 2^16 (65,536) values before being able to replicate the state of the PRNG.
Illustrative examples
Real CVEs that MITRE cites as examples of this weakness.
- CVE-2019-10908 — product generates passwords via org.apache.commons.lang.RandomStringUtils, which uses java.util.Random internally. This PRNG has only a 48-bit seed.
Terminology & mappings
Mapped taxonomies
- PLOVER: Small Seed Space in PRNG
Frequently asked questions
Common questions about CWE-339.
- What is CWE-339?
- A Pseudo-Random Number Generator (PRNG) uses a relatively small seed space, which makes it more susceptible to brute force attacks.
- What CVEs are caused by CWE-339?
- 1 recorded CVEs are attributed to CWE-339, including CVE-2026-2815.
- How do you prevent CWE-339?
- Use well vetted pseudo-random number generating algorithms with adequate length seeds. 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.
- What are the consequences of CWE-339?
- Exploiting CWE-339 can lead to: Varies by Context.
- Is CWE-339 actively exploited?
- 1 recorded CVEs are caused by CWE-339; none are currently in CISA's KEV catalog of actively exploited flaws.
References
- MITRE CWE definition (CWE-339) (opens in a new tab)
- CWE-339 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.
Stay ahead of CWE-339
Get alerted the moment a new CWE-339 vulnerability affects your stack, with AI-written analysis, severity context, and remediation guidance.