---
title: "CWE-341: Predictable from Observable State"
url: https://radicalnotion.ai/cwe/cwe-341
type: cwe
description: "A number or object is predictable based on observations that the attacker can make about the state of the system or network, such as time, process ID, etc."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-341: Predictable from Observable State

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

## Description

A number or object is predictable based on observations that the attacker can make about the state of the system or network, such as time, process ID, etc.

## Modes of introduction

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

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Other | Varies by Context | This weakness could be exploited by an attacker in a number of ways depending on the context. If a predictable number is used to generate IDs or keys that are used within protection mechanisms, then an attacker could gain unauthorized access to the system. If predictable filenames are used for storing sensitive information, then an attacker might gain access to the system and may be able to gain access to the information in the file. |

## Potential mitigations

### Implementation

Increase the entropy used to seed a PRNG.

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

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").

### Implementation

Use a PRNG that periodically re-seeds itself using input from high-quality sources, such as hardware devices with high entropy. However, do not re-seed too frequently, or else the entropy source might block.

## 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.)

## Demonstrative examples

### Example 1

This code generates a unique random identifier for a user's session.

Bad code:

```php
function generateSessionID($userID){
    srand($userID);
    return rand();
}
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2024-48445 | Chain: e-commerce app relies on an easily-guessable timestamp (CWE-341) in a weak authentication algorithm (CWE-1390) |
| CVE-2002-0389 | Mail server stores private mail messages with predictable filenames in a world-executable directory, which allows local users to read private mailing list archives. |
| CVE-2001-1141 | PRNG allows attackers to use the output of small PRNG requests to determine the internal state information, which could be used by attackers to predict future pseudo-random numbers. |
| CVE-2000-0335 | DNS resolver library uses predictable IDs, which allows a local attacker to spoof DNS query results. |
| CVE-2005-1636 | MFV. predictable filename and insecure permissions allows file modification to execute SQL queries. |

## Real CVEs with this weakness (sample of 12 of 20)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-38968 | - | critical | 9.8 | - | No | 2026-07-02 |
| CVE-2020-1731 | Predictable password in Keycloak | critical | 9.8 | - | No | 2020-03-02 |
| CVE-2019-6563 | Predictable from Observable State in Moxa IKS, EDS | critical | 9.8 | - | No | 2019-03-05 |
| CVE-2026-135171 | Wing FTP Server before 8.2.8 Predictable Administrator Session Identifier | critical | 9.2 | - | No | 2026-11-23 |
| CVE-2026-130868 | GreaterWMS through 2.1.54 Predictable openid Authentication Token Generation | critical | 9.1 | - | No | 2026-11-17 |
| CVE-2026-42365 | GeoVision LPC2011/LPC2211 Web Interface guessable session cookie vulnerability | high | 8.6 | - | No | 2026-05-04 |
| CVE-2025-40780 | Cache poisoning due to weak PRNG | high | 8.6 | - | No | 2025-10-22 |
| CVE-2023-49259 | Bruteforcing authentication cookie for a given user | high | 7.5 | - | No | 2024-01-12 |
| CVE-2020-5365 | - | high | 7.5 | - | No | 2020-05-20 |
| CVE-2026-133097 | In JetBrains TeamCity before 2026.2.2, 2026.1.6 agent Push authorization keys were predictable | high | 7.4 | - | No | 2026-11-19 |
| CVE-2026-15571 | Keycloak-services: keycloak-services: predictable account-linking hash enables account takeover via malicious oidc client | high | 7.3 | - | No | 2026-08-18 |
| CVE-2026-36609 | - | high | 7.3 | - | No | 2026-06-03 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-340](https://radicalnotion.ai/cwe/cwe-340) | Generation of Predictable Numbers or Identifiers |
| Peer | [CWE-339](https://radicalnotion.ai/cwe/cwe-339) | Small Seed Space in PRNG |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Predictable from Observable State | - | - |

## Frequently asked questions

### What is CWE-341?

A number or object is predictable based on observations that the attacker can make about the state of the system or network, such as time, process ID, etc.

### What CVEs are caused by CWE-341?

20 recorded CVEs are attributed to CWE-341, including CVE-2026-38968, CVE-2020-1731 and CVE-2019-6563.

### How do you prevent CWE-341?

Increase the entropy used to seed a PRNG.

### How is CWE-341 detected?

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

### What are the consequences of CWE-341?

Exploiting CWE-341 can lead to: Varies by Context.

### Is CWE-341 actively exploited?

20 recorded CVEs are caused by CWE-341; none are currently in CISA's KEV catalog of actively exploited flaws.

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

---

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