---
title: "CWE-339: Small Seed Space in PRNG"
url: https://radicalnotion.ai/cwe/cwe-339
type: cwe
description: "A Pseudo-Random Number Generator (PRNG) uses a relatively small seed space, which makes it more susceptible to brute force attacks."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-339: Small Seed Space in PRNG

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 1
- **Of those, in CISA KEV:** 0
- **New in 2026:** 1
- **CWE catalog version:** 4.21

## Description

A Pseudo-Random Number Generator (PRNG) uses a relatively small seed space, which makes it more susceptible to brute force attacks.

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.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | REALIZATION: This weakness is caused during implementation of an architectural security tactic. |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Other | Varies by Context | - |

## Potential mitigations

### Architecture and Design

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.

### Architecture and Design, Requirements (Libraries or Frameworks)

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.

## Demonstrative examples

### Example 1

This code grabs some random bytes and uses them for a seed in a PRNG, in order to generate a new cryptographic key.

Bad code:

```python
# getting 2 bytes of randomness for the seeding the PRNG
seed = os.urandom(2)
random.seed(a=seed)
key = random.getrandbits(128)
```

Since 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.

## Observed examples

| CVE | Description |
| --- | --- |
| 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. |

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-2815 | Incorrect use of the PUF key for user key generation in EFR32xG27 results in predictable keys | high | 8.4 | - | No | 2026-06-25 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-335](https://radicalnotion.ai/cwe/cwe-335) | Incorrect Usage of Seeds in Pseudo-Random Number Generator (PRNG) |
| Peer | [CWE-341](https://radicalnotion.ai/cwe/cwe-341) | Predictable from Observable State |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Small Seed Space in PRNG | - | - |

## Frequently asked questions

### 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 CVE is attributed to CWE-339: 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 CVE is caused by CWE-339; it is not currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/339.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-339). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
