Vulnerability · Published Jan 17, 2023 · Assigned by GitHub_M
CVE-2021-32837mechanize vulnerable to ReDoS
High 7.5
In plain English
A high-severity regular-expression denial of service in mechanize from python-mechanize. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 28.7% (higher than 98% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official 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 packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | python-mechanize | 1:0.4.7-1 | DEBIAN-CVE-2021-32837 |
| Debian:13 | python-mechanize | 1:0.4.7-1 | DEBIAN-CVE-2021-32837 |
| Debian:14 | python-mechanize | 1:0.4.7-1 | DEBIAN-CVE-2021-32837 |
| PyPI | mechanize | 0.4.6 | GHSA-g3pv-pj5f-3hfq |
| PyPI | mechanize | 0.4.6 | PYSEC-2023-25 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| python-mechanize | mechanize | 0.4.6 – before 0.4.6 |
Weakness: CWE-1333 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
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
- https://lists.debian.org/debian-lts-announce/2025/12/msg00028.html