python-urllib3 — security advisory
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).
- Products
- python-urllib3
- Affected versions
- Not specified
- Fixed versions
- 1.25.8-1
- CVEs
- CVE-2020-7212
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 1 Nov 2026, 13:16 UTC · Revision 1
Source evidence
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).
osv:DEBIAN-CVE-2020-7212
python-urllib3
Fixed versions: 1.25.8-1
python-urllib3
Fixed versions: 1.25.8-1
python-urllib3
Fixed versions: 1.25.8-1
Complete source record
{
"id": "67dce7048fa22b8564f4552c9ee1ec54340984e08ad711c1286d9ed385ba987c",
"url": "https://osv.dev/vulnerability/DEBIAN-CVE-2020-7212",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "DEBIAN-CVE-2020-7212",
"summary": "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).",
"evidence": "osv:DEBIAN-CVE-2020-7212",
"products": [
{
"name": {
"value": "python-urllib3",
"evidence": "/affected/0/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "1.25.8-1",
"evidence": "/affected/0/ranges"
}
],
"affected_versions": []
},
{
"name": {
"value": "python-urllib3",
"evidence": "/affected/1/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "1.25.8-1",
"evidence": "/affected/1/ranges"
}
],
"affected_versions": []
},
{
"name": {
"value": "python-urllib3",
"evidence": "/affected/2/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "1.25.8-1",
"evidence": "/affected/2/ranges"
}
],
"affected_versions": []
}
],
"severity": "high",
"structured": {
"id": "DEBIAN-CVE-2020-7212",
"aliases": [
"DEBIAN-CVE-2020-7212"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
}
],
"affected": [
{
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "0"
},
{
"fixed": "1.25.8-1"
}
]
}
],
"package": {
"name": "python-urllib3",
"purl": "pkg:deb/debian/python-urllib3?arch=source&distro=bookworm",
"ecosystem": "Debian:12"
},
"database_specific": {
"source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2020-7212.json"
},
"ecosystem_specific": {
"urgency": "not yet assigned"
}
},
{
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "0"
},
{
"fixed": "1.25.8-1"
}
]
}
],
"package": {
"name": "python-urllib3",
"purl": "pkg:deb/debian/python-urllib3?arch=source&distro=trixie",
"ecosystem": "Debian:13"
},
"database_specific": {
"source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2020-7212.json"
},
"ecosystem_specific": {
"urgency": "not yet assigned"
}
},
{
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "0"
},
{
"fixed": "1.25.8-1"
}
]
}
],
"package": {
"name": "python-urllib3",
"purl": "pkg:deb/debian/python-urllib3?arch=source&distro=forky",
"ecosystem": "Debian:14"
},
"database_specific": {
"source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2020-7212.json"
},
"ecosystem_specific": {
"urgency": "not yet assigned"
}
}
],
"modified": "2026-10-26T12:02:15.935074333Z",
"provider": "osv",
"upstream": [
"CVE-2020-7212"
],
"references": [
"https://security-tracker.debian.org/tracker/CVE-2020-7212"
]
},
"related_cves": [
{
"value": "CVE-2020-7212",
"evidence": "/upstream"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 452067,
"published_at": "2020-03-06T20:15:12.707+00:00"
}