News

USN-9123-1: ReDoS vulnerability in mechanize, patch only with Ubuntu Pro on 20.04, 18.04 and 16.04

Ubuntu addresses CVE-2021-32837 in python-mechanize: an inefficient regex can cause DoS. Fix available only via ESM Apps on 20.04, 18.04 and 16.04.

UptimeMag editorial team · 17 November 2026 · 1 min read

USN-9123-1: falla ReDoS in mechanize, patch solo con Ubuntu Pro su 20.04, 18.04 e 16.04

Canonical released advisory USN-9123-1 on 17 November 2026, addressing a denial of service vulnerability in the python-mechanize package, a Python library used to automate interaction with HTTP servers (login, forms, scraping). It affects those still running automation scripts or internal tools based on mechanize on Ubuntu 20.04, 18.04 or 16.04 LTS.

What's the issue

The vulnerability, identified as CVE-2021-32837, was discovered by Erik Krogh Kristensen and Rasmus Petersen: mechanize uses an inefficient regular expression to parse authentication headers. A malicious server can exploit this flaw to cause the client to consume excessive resources, resulting in a denial of service. The vulnerability, known as ReDoS (Regular Expression Denial of Service), was identified through automated code analysis and found using a CodeQL query that detects inefficient regular expressions, with precise reference to the vulnerable line of code. The upstream fix had already been released in 2021 with mechanize version 0.4.6.

Fixed versions

Ubuntu Release Package Fixed Version
20.04 LTS (focal) python3-mechanize 1:0.4.5-2ubuntu0.1~esm1
18.04 LTS (bionic) python-mechanize 1:0.2.5-3ubuntu0.18.04.1~esm1
16.04 LTS (xenial) python-mechanize 1:0.2.5-3ubuntu0.16.04.1~esm1

Why Ubuntu Pro is required

All three releases are beyond standard support: 20.04 LTS exited its five-year support window on 31 May 2025, as stated on the official release page, whilst 18.04 and 16.04 expired years earlier. As a result, the patched package is available only through Ubuntu Pro, in the ESM Apps channel: without an active subscription, no patch will be delivered for these versions. For those managing just a few servers, this carries no cost: the subscription remains free for up to five machines for personal and small-scale commercial use, as stated in Canonical's official documentation.

Anyone still running mechanize in production on these LTS releases should verify whether they already have ESM enabled using pro status and, if not, should consider enabling it or migrating to a more recent release, where the package is unaffected.

Written with the help of artificial intelligence and checked by the editors (EU AI Act, art. 50).