CVE-2021-32837 mechanize vulnerable to ReDoS

High 7.5 Published Updated

A malicious web server can cause the mechanize library to crash via a regular expression denial of service attack.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2021-32837?

CVE-2021-32837 is a high-severity denial of service vulnerability in python-mechanize mechanize, published on 17 Jan 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

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.

Weakness: CWE-1333

Which versions are affected by CVE-2021-32837?

3 open source packages ship an affected version, including mechanize. It affects 1 product.

PackageAffectedFixed in
mechanize PyPIAll versions0.4.6
mechanize PyPIAll versions0.4.6
mechanize PyPIAll versions0.4.6
Linux distribution packages (3)
python-mechanize SUSE:Package Hub 15 SP4All versions0.4.8-bp154.2.3.1
python-mechanize openSUSE:Leap 15.4All versions0.4.8-bp154.2.3.1
python-mechanize openSUSE:TumbleweedAll versions0.4.10-1.4

Products include Mechanize Project Mechanize.

How do I fix CVE-2021-32837?

Upgrade mechanize to 0.4.6 or later.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2021-32837 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-32837 exists.

Sources

Also known as DEBIAN-CVE-2021-32837, DLA-3460-1, DLA-4418-1, GHSA-g3pv-pj5f-3hfq, MGASA-2023-0036, PYSEC-2023-25 and 4 more.

Is CVE-2021-32837 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free