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
Published: 2026-07-18
Score: 9.2 Critical
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

The urwid web display backend constructs session identifiers by concatenating two calls to random.randrange(109), which employs Python’s Mersenne Twister PRNG, not suitable for cryptographic purposes. Each identifier leaks about 30 bits of the PRNG’s ~19,937‑bit internal state; observing roughly 334 session IDs (e.g., via the X‑Urwid‑ID HTTP response header) allows an attacker to reconstruct the internal state and predict all past and future session identifiers. The same token names a FIFO file in the world‑listable /tmp directory; any local user can enumerate active session tokens by listing /tmp. With a valid session ID an attacker can read the victim’s terminal screen, inject keystrokes (potentially executing shell commands with the session owner’s privileges if a shell is running), or flood the FIFO to terminate or crash the session. This flaw combines insecure random number generation (CWE‑338) with local enumeration of sensitive data (CWE‑1241) and enables remote code execution when the session runs a shell.

Affected Systems

All installations of the urwid Python library that include the web display backend (urwid:urwid) are affected. No specific version constraints are provided, so any current release that has not been updated with the fix is considered vulnerable.

Risk and Exploitability

The CVSS score of 9.2 indicates severe confidentiality, integrity, and availability impact. The EPSS score of <1% signals a very low probability of exploitation in the near term. Exploitation requires observing session identifiers (through the X‑Urwid‑ID header or capturing traffic) or enumerating FIFO files via local /tmp access. The attack is most practical for local users or those who can intercept web traffic; no publicly documented network exploit path exists. The vulnerability is not listed in CISA’s KEV catalog.

Generated by OpenCVE AI on August 4, 2026 at 18:28 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade to the latest urwid release that replaces the insecure Mersenne Twister usage with a cryptographically secure random source such as os.urandom.
  • Remove or conceal the X‑Urwid‑ID response header so that session identifiers are not exposed to network observers.
  • Restrict file‑system permissions on /tmp or move the FIFO files to a location only accessible by the session owner, preventing other local users from enumerating active sessions.
  • Enforce stricter local privilege boundaries, ensuring that users who should not interact with urwid sessions cannot read /tmp or execute arbitrary commands through the polling endpoint.

Generated by OpenCVE AI on August 4, 2026 at 18:28 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Thu, 23 Jul 2026 21:45:00 +0000

Type Values Removed Values Added
First Time appeared Urwid
Urwid urwid
Vendors & Products Urwid
Urwid urwid

Tue, 21 Jul 2026 00:15:00 +0000

Type Values Removed Values Added
Weaknesses CWE-1241
References
Metrics threat_severity

None

threat_severity

Important


Mon, 20 Jul 2026 20:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Sat, 18 Jul 2026 14:15:00 +0000

Type Values Removed Values Added
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
Title Insecure PRNG and Information Exposure in urwid Web Display Backend
Weaknesses CWE-338
References
Metrics cvssV3_1

{'score': 8.1, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H'}

cvssV4_0

{'score': 9.2, 'vector': 'CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}


cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-07-20T19:31:48.456Z

Reserved: 2026-05-22T20:56:42.239Z

Link: CVE-2026-9323

cve-icon Vulnrichment

Updated: 2026-07-20T19:26:51.313Z

cve-icon NVD

No data.

cve-icon Redhat

Severity : Important

Publid Date: 2026-07-18T13:51:06Z

Links: CVE-2026-9323 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-08-04T18:30:12Z

Weaknesses
  • CWE-1241

    Use of Predictable Algorithm in Random Number Generator

  • CWE-338

    Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)