CVE-2026-9323 in urwidinfo

Summary

by MITRE • 07/18/2026

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

If you want to get the best quality for vulnerability data then you always have to consider VulDB.

Analysis

by VulDB Data Team • 07/19/2026

The urwid web display backend presents a critical security vulnerability through its weak session identifier generation mechanism that fundamentally compromises the integrity and confidentiality of user sessions. This flaw exists in the Screen.start() method where two calls to random.randrange(10**9) are concatenated to form the urwid_id, creating predictably weak identifiers that rely on Python's Mersenne Twister pseudorandom number generator. The Mersenne Twister algorithm, while suitable for simulations and general computing tasks, lacks cryptographic security properties necessary for session management and is explicitly classified as unsuitable for security-sensitive applications under CWE-331 and NIST SP 800-90A guidelines.

The vulnerability manifests through two distinct attack pathways that compound the risk. Path A exploits the fundamental flaw in session identifier generation where attackers can observe approximately 334 session IDs from HTTP response headers to reconstruct the complete internal state of the Mersenne Twister PRNG, enabling prediction of all past and future identifiers. This represents a classic cryptanalysis vulnerability where the output entropy is insufficient to resist state reconstruction attacks as defined in CWE-330. Path B leverages the predictable session identifiers to directly access system resources since each identifier becomes the filename for a FIFO created in the world-listable /tmp directory, allowing any local user to enumerate active sessions simply by listing directory contents.

The operational impact of this vulnerability extends far beyond simple information disclosure, encompassing complete system compromise through multiple attack vectors. With valid session IDs, attackers can perform screen reading operations against victim terminals via polling endpoints, effectively enabling passive surveillance of user activities. More critically, the ability to inject keystrokes into active sessions provides a direct path to OS-level code execution with privileges equal to the session owner, representing a privilege escalation vulnerability that aligns with ATT&CK technique T1059. The injection of exit sequences or flooding of FIFO channels can also be used for denial-of-service attacks against legitimate users.

The security implications are exacerbated by the explicit suppression of existing warnings in the codebase, specifically the Bandit S311 warning that would have flagged the use of non-cryptographic random functions for security purposes. This deliberate suppression with # noqa: S311 demonstrates a lack of security awareness and proper code review processes that violates security best practices outlined in OWASP ASVS and ISO/IEC 27001 controls. The vulnerability directly maps to ATT&CK techniques including T1566 for credential access through session hijacking, T1068 for privilege escalation, and T1499 for network denial-of-service attacks. Effective mitigations require immediate replacement of the weak random number generator with a cryptographically secure alternative such as os.urandom() or secrets.token_urlsafe(), implementation of proper session management with strong entropy sources, and removal of world-readable temporary files that expose session identifiers to unauthorized enumeration.

Responsible

VulnCheck

Reservation

05/22/2026

Disclosure

07/18/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

medium

Sources

Want to know what is going to be exploited?

We predict KEV entries!