CVE-2020-7212Python Urllib3
High 7.5 No auth needed
Follow: this CVE · Python · Python Urllib3 We alert you by email or Slack (account required).
- Priority
- 60
- CVSS 3.1
- 7.5
- EPSS
- 3.4% probability of exploitation in 30 days · percentile 90
- Auth required
- No
- Published
- Mar 6, 2020
- Updated
- Jun 17, 2026
- Category
- Application · Cross-platform
- Weakness (CWE)
- CWE-400
- Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
What happens
The _encode_invalid_chars function in util/url.py in the urllib3 library 1.25.2 through 1.25.7 for Python allows a denial of service (CPU consumption) because of an inefficient algorithm. The percent_encodings array contains all matches of percent encodings. It is not deduplicated. For a URL of length N, the size of percent_encodings may be up to O(N). The next step (normalize existing percent-encoded bytes) also takes up to O(N) for each step, so the total time is O(N^2). If percent_encodings were deduplicated, the time to compute _encode_invalid_chars would be O(kN), where k is at most 484 ((10+6*2)^2).
What to do
- Apply the vendor's security update for Urllib3.
- It can be exploited without authentication: if you cannot patch now, restrict Internet access to the affected service.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | How to upgrade |
|---|---|---|---|---|
| PyPI | urllib3 |
≥ 1.25.2 < 1.25.8 |
1.25.8 |
pip install "urllib3>=1.25.8" |
| PyPI | urllib3 |
≥ 1.25.2 < 1.25.8 |
1.25.8 |
pip install "urllib3>=1.25.8" |
Per OSV / GitHub Advisories (GHSA-hmv2-79q8-fv6g, PYSEC-2020-149). Check the version in your lockfile before upgrading.
Affected products (CPE)
| Vendor | Product | Versions |
|---|---|---|
| python | urllib3 | ≥ 1.25.2 ≤ 1.25.7 |
Official sources
References
Links published by the sources. Open them with care.
- github.com Release Notes Third Party Advisory
- github.com Patch Third Party Advisory
- pypi.org Release Notes Vendor Advisory