Medium

Urwid: handle_short_request() crashes on non-ASCII POST body (UnicodeEncodeError DoS)

  • Disclosed: 09.11.2026
  • Updated: 10.11.2026 00:17

Summary

The handle_short_request() function in urwid/display/web.py raises an unhandled UnicodeEncodeError when processing a POST request body containing non-ASCII bytes. The function reads POST input and encodes it to ASCII before writing to a named pipe. Any byte value above 0x7F causes the CGI process to exit with an unhandled exception, returning an HTTP 500 error to the client. Additionally, a file descriptor opened earlier in the same function is not closed before the exception propagates, causing a file descriptor leak for the lifetime of the CGI process.

A second instance of missing exception handling exists in the polling update path, where non-UTF-8 socket output causes an unhandled UnicodeDecodeError.

Impact

An attacker who observes a valid X-Urwid-ID session token (transmitted in plaintext HTTP response headers) can send repeated POST requests containing non-ASCII bytes to the urwid CGI endpoint. Each malformed request causes the CGI handler to crash with HTTP 500. This results in a Denial of Service (DoS) for legitimate users using the urwid web interface.

Affected Versions

urwid <= 4.0.6

Patches

Fixed in urwid 4.0.7. Users should upgrade to version 4.0.7 or later.

Workarounds

No direct workaround exists short of disabling the urwid web display interface.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) urwid < 4.0.7 4.0.7

References

CVSS score 5.3/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
Weakness (CWE)
CWE-116, CWE-248, CWE-775
Platform
Python (PyPI)
Package
urwid
Disclosed
09.11.2026
Updated
10.11.2026 00:17

Sources and licenses

OSV / GitHub Advisory Database - GHSA-cp25-j9x5-p5xm - CC BY 4.0

Vulnerability history: urwid

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

This is the only known vulnerability of this package.

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.