# Duplicate Advisory: urwid: Insecure PRNG and Information Exposure in Web Display Backend

Source: https://junglewise.ai/threats/duplicate-advisory-urwid-insecure-prng-and-information-exposure-in-web-f0e7011b  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-07-18  
License: CC BY 4.0 with a link back

Severity: high · CVSS 8.1 · Published 2026-07-18

### Duplicate Advisory
This advisory has been withdrawn because it is a duplicate of GHSA-rjwp-g85x-gmjv. This link is maintained to preserve external references.

### Original Description
The urwid web display backend (urwid/display/web.py) generates web session identifiers (urwid_id) in Screen.start() by concatenating two random.randrange(10**9) calls that use Python's Mersenne Twister PRNG, which is not cryptographically secure. Each call consumes approximately 30 bits of PRNG state, and the Mersenne Twister internal state is approximately 19,937 bits, so an attacker who observes approximately 334 session IDs (for example via the X-Urwid-ID HTTP response header) can fully reconstruct the internal state and predict all past and future session IDs (Path B). The same identifier is also used as the filename of a FIFO created in the world-listable /tmp directory (for example /tmp/urwid375487765176907690.in), so any local user on the host can list /tmp to enumerate active session tokens directly (Path A). With a valid session ID, an attacker can read the victim's terminal screen via the polling endpoint, inject keystrokes into the victim's session (yielding OS-level code execution with the session owner's privileges if the session runs a shell), and inject exit sequences or flood the FIFO to terminate or crash the session. A prior Bandit S311 warning on this usage was suppressed with # noqa: S311 rather than fixed

Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** High severity, with a CVSS score of 8.1, published 18 July 2026.

**Which products and versions are affected?** urwid (PyPI) < 4.0.6, ECOSYSTEM:introduced=0,fixed=4.0.6.

**Is there a fix for This vulnerability?** Yes. urwid (PyPI): upgrade to 4.0.6 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**Am I affected?** Check whether you run urwid (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- urwid (PyPI): upgrade to 4.0.6 or later

  ```sh
  pip install "urwid>=4.0.6"
  ```


## Affected products

- urwid (PyPI) < 4.0.6, ECOSYSTEM:introduced=0,fixed=4.0.6

## Related threats

- [Urwid encoding handling denial of service in web display](https://junglewise.ai/threats/cve-2026-103022-urwid-is-a-console-user-interface-library-for-python-prior-to-4)
