Description
mechanize, a library for automatically interacting with HTTP web servers, contains a regular expression that is vulnerable to regular expression denial of service (ReDoS) prior to version 0.4.6. If a web server responds in a malicious way, then mechanize could crash. Version 0.4.6 has a patch for the issue.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| python-mechanize | mechanize | 0.4.6 – < 0.4.6 | 0.4.6 |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | python-mechanize | 1:0.4.7-1 | — |
| Debian 13 | python-mechanize | 1:0.4.7-1 | — |
| Debian 12 | python-mechanize | 1:0.4.7-1 | — |
| Debian 11 | python-mechanize | 1:0.4.5-2+deb11u1 | DLA-4418-1 |
| Debian 10 | python-mechanize | 1:0.2.5-3+deb10u1 | DLA-3460-1 |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 20.04 LTS | python-mechanize | No fix yet | — |
| Ubuntu 18.04 LTS | python-mechanize | No fix yet | — |
| Ubuntu 16.04 LTS | python-mechanize | No fix yet | — |
SUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| SUSE Package Hub 15 SP4 | python-mechanize | 0.4.8-bp154.2.3.1 | openSUSE-SU-2023:0030-1 |
openSUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| openSUSE Tumbleweed | python-mechanize | 0.4.10-1.4 | openSUSE-SU-2025:15098-1 |
| openSUSE Leap 15.4 | python-mechanize | 0.4.8-bp154.2.3.1 | openSUSE-SU-2023:0030-1 |
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| PyPI | mechanize | < 0.4.6 | 0.4.6 | GHSA-g3pv-pj5f-3hfq |
Advisories 4
- DLA-3460-1 python-mechanize - security update Debian Security (DSA / DLA) · Mar 9, 2026
- openSUSE-SU-2023:0030-1 Security update for python-mechanize SUSE / openSUSE Security Updates · Feb 4, 2026
- openSUSE-SU-2025:15098-1 python311-mechanize-0.4.10-1.4 on GA media SUSE / openSUSE Security Updates · Feb 4, 2026
- DLA-4418-1 python-mechanize - security update Debian Security (DSA / DLA) · Dec 22, 2025
References
- https://securitylab.github.com/advisories/GHSL-2021-108-python-mechanize-mechanize/
- https://github.com/python-mechanize/mechanize/blob/3acb1836f3fd8edc5a758a417dd46b53832ae3b5/mechanize/_urllib2_fork.py#L878-L879
- https://github.com/python-mechanize/mechanize/releases/tag/v0.4.6
- https://github.com/python-mechanize/mechanize/commit/dd05334448e9f39814bab044d2eaa5ef69b410d6
- [debian-lts-announce] 20230620 [SECURITY] [DLA 3460-1] python-mechanize security update mailing-list