Skip to content

CVE-2020-7212 Uncontrolled Resource Consumption in urllib3

HighCVSS 7.5 EPSS 3.4%
Published
Updated
Exploit status
No public exploit known
Technology
UbuntuDebian

Description

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

Upgrade path

6 packages: 6 fixed.

PackageAffectedFixed inStatus
debian/python-urllib3(Debian 12) < 1.25.8-1 1.25.8-1 Fixed
debian/python-urllib3(Debian 13) < 1.25.8-1 1.25.8-1 Fixed
debian/python-urllib3(Debian 14) < 1.25.8-1 1.25.8-1 Fixed
pypi urllib3(PyPI) = 1.25.2; = 1.25.3; = 1.25.4; = 1.25.5 +4 more 1.25.8 Fixed
python urllib3 >= 1.25.2, <= 1.25.7 after 1.25.7 Fixed
ubuntu/python-urllib3(Ubuntu 20.04) < 1.25.8-2; = 1.24.1-1ubuntu1; = 1.24.1-1ubuntu2; = 1.25.8-1 1.25.8-2 Fixed

Affected products

ProductAffected versionsFixed in
pypi urllib3(PyPI) >= 1.25.2, < 1.25.8 1.25.8
pypi urllib3(PyPI) = 1.25.2 No fix listed
pypi urllib3(PyPI) = 1.25.3 No fix listed
pypi urllib3(PyPI) = 1.25.4 No fix listed
pypi urllib3(PyPI) = 1.25.5 No fix listed
pypi urllib3(PyPI) = 1.25.6 No fix listed
pypi urllib3(PyPI) = 1.25.7 No fix listed
pypi urllib3(PyPI) >= 1.25.2, <= 1.25.7 No fix listed
debian/python-urllib3(Debian:12) < 1.25.8-1 1.25.8-1
debian/python-urllib3(Debian:13) < 1.25.8-1 1.25.8-1
debian/python-urllib3(Debian:14) < 1.25.8-1 1.25.8-1
python urllib3 >= 1.25.2, <= 1.25.7 No fix listed
ubuntu/python-urllib3(Ubuntu:20.04) < 1.25.8-2 1.25.8-2
ubuntu/python-urllib3(Ubuntu:20.04) = 1.24.1-1ubuntu1 No fix listed
ubuntu/python-urllib3(Ubuntu:20.04) = 1.24.1-1ubuntu2 No fix listed
ubuntu/python-urllib3(Ubuntu:20.04) = 1.25.8-1 No fix listed

References