CVE-2021-32837: mechanize Regular Expression Denial of Service vulnerability
7.5
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.88099%
CWE
Published
1/18/2023
Updated
9/24/2024
KEV Status
No
Technology
Python
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| mechanize | pip | < 0.4.6 | 0.4.6 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stemmed from an inefficient regex pattern in AbstractBasicAuthHandler's authentication header parsing. The commit dd05334 explicitly replaced this regex with a more efficient version from Python 3.9's urllib, and added tests verifying rejection of malicious inputs like ',,,,,,...'. The regex's structure (particularly the '(?:.,)' portion) made it susceptible to ReDoS when processing headers with many unprocessed comma separators, as demonstrated in the test case.