---
id: "GHSA-83x9-8wvq-rrcp"
kind: "vulnerability"
aliases: ["GHSA-83x9-8wvq-rrcp"]
title: "Duplicate Advisory: urwid: Insecure PRNG and Information Exposure in Web Display Backend"
severity: "critical"
cvss: 8.1
epss: null
exploited: false
status: "withdrawn"
category: "package"
products: [{"name": "urwid", "fixed": ["4.0.6"], "affected": "< 4.0.6", "ecosystem": "pypi"}]
ecosystems: ["pypi"]
tags: ["cwe-338", "package", "python", "self-hosted", "urwid"]
not_affected_if: ["no-web-display-backend", "terminal-only-usage"]
published_at: "2026-07-18T15:31:50+00:00"
first_seen_at: "2026-11-05T15:20:50+00:00"
updated_at: "2026-11-05T15:21:59+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-83x9-8wvq-rrcp", "first_seen_at": "2026-11-05T15:20:50+00:00"}]
exploit_sources: []
---

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

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.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- pypi:urwid affected < 4.0.6 fixed 4.0.6

## How to check

- Check the installed urwid version with `pip show urwid`
- Look for `urwid/display/web.py` in the environment and whether the web display backend is used
- Check for FIFOs named `urwid*.in` in `/tmp`

## Fix

- `urwid` `4.0.6` (fixed version per product data)

## Timeline

- 2026-11-05T15:20:50+00:00 ghsa https://github.com/advisories/GHSA-83x9-8wvq-rrcp

## Documents

- [advisory] Maintainer's advisory: github.com https://github.com/urwid/urwid/security/advisories/GHSA-rjwp-g85x-gmjv
- [fix] Patch: github.com https://github.com/urwid/urwid/pull/1128
- [fix] Patch: github.com https://github.com/urwid/urwid/commit/24acd12f0d0598036d0d577f2ee63e4a27b4a3d9

## From the sources

### 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

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
