Monitor vulnerabilities like this one. Sign up free to get alerted when software you use is affected.
9.2

CVE-2026-9323: urwid: Insecure Session IDs Can Be Predicted by Attackers

CVE-2026-9323 CVE-2026-9323
Summary

The urwid web display backend generates session IDs that can be easily predicted by attackers, allowing them to read sensitive information, inject keystrokes, and even take control of a user's session. This issue affects users who run urwid on a shared host or in a multi-user environment. To mitigate this risk, consider upgrading to a more secure random number generator or using a different method to generate session IDs.

What to do

No fix is available yet. Check with your software vendor for updates.

Affected software
VendorProductAffected versions
urwid urwid <= 24acd12
Original title
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 Twi...
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
nvd CVSS3.1 8.1
nvd CVSS4.0 9.2
Vulnerability type
CWE-338
Published: 18 Jul 2026 · Updated: 20 Jul 2026 · First seen: 18 Jul 2026