CVE-2020-7212
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
Fixed builds are available from Debian, PyPI: see the table below for the fixed version per release.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 16.04 | python-urllib3 | Not affected vulnerable_code_not_present | ||
| Debian 14 | python-urllib3 | Fixed | 1.25.8-1 | DEBIAN-CVE-2020-7212 |
| Debian 13 | python-urllib3 | Fixed | 1.25.8-1 | DEBIAN-CVE-2020-7212 |
| Debian 12 | python-urllib3 | Fixed | 1.25.8-1 | DEBIAN-CVE-2020-7212 |
| Red Hat Enterprise Linux 8 | python-urllib3 | Not affected | ||
| Red Hat Enterprise Linux 8 | python3-urllib3 | Not affected | ||
| Red Hat Enterprise Linux 7 | python-urllib3 | Not affected | ||
| Red Hat Enterprise Linux 6 | python-urllib3 | Not affected | ||
| PyPI library | urllib3 | Fixed | 1.25.8 | PYSEC-2020-149 |
References
- https://github.com/urllib3/urllib3/blob/master/CHANGES.rst
- https://github.com/urllib3/urllib3/commit/a74c9cfbaed9f811e7563cfc3dce894928e0221a
- https://pypi.org/project/urllib3/1.25.8/
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.