URWID · GHSA-83x9-8wvq-rrcp · Package
FIX → 4.0.6
The urwid web display backend builds session IDs from Python's non-cryptographic random generator, and the same ID names a FIFO in the world-readable /tmp directory. An attacker who can list /tmp or observe enough IDs can read a victim's terminal screen and inject keystrokes, which can mean code execution as the session owner.
first public Jul 18, 2026 · 1 source
Check it with your coding agent
It checks your repository and tells you if you’re affected, with the fix.
Only applications that run urwid's web display backend (Screen.start in urwid/display/web.py) are exposed; applications using other urwid display backends are not. The advisory was withdrawn as a duplicate of GHSA-rjwp-g85x-gmjv, so the affected range and fix come from the product data here rather than a standalone advisory.
Not affected if no-web-display-backend, terminal-only-usage
Who cares cwe-338, python, self-hosted, urwid
pip show urwidurwid/display/web.py in the environment and whether the web display backend is usedurwid*.in in /tmpUpgrade to 4.0.6
This advisory has been withdrawn because it is a duplicate of GHSA-rjwp-g85x-gmjv. This link is maintained to preserve external references.
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
Are you affected?
Tell InfraStack what you run. It checks this one, and every next one, against your stack.
Ask from here. InfraStack checks the affected versions against your stack and answers in your inbox.
InfraStack checks the affected versions against your stack and answers in Slack, with the evidence and the fix.
urwid4.0.6GitHub Advisory Database, CC-BY 4.0. Posts quoted belong to their authors.