Skip to content

GHSA-2xpw-w6gg-jr37 CVE-2025-66471 PYSEC-2026-1994

urllib3 streaming API improperly handles highly compressed data

High PyPI
Severity
8.9 / 10
High · CVSS 4.0
Exploit chance (EPSS)
0.68%
Chance of exploitation in the next 30 days. Higher than 52.48% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-409 Improper Handling of Highly Compressed Data (Data Amplification)
Fix
2.6.0
Upgrade urllib3 to this version or later

Description

Impact

urllib3's streaming API is designed for the efficient handling of large HTTP responses by reading the content in chunks, rather than loading the entire response body into memory at once.

When streaming a compressed response, urllib3 can perform decoding or decompression based on the HTTP Content-Encoding header (e.g., gzip, deflate, br, or zstd). The library must read compressed data from the network and decompress it until the requested chunk size is met. Any resulting decompressed data that exceeds the requested amount is held in an internal buffer for the next read operation.

The decompression logic could cause urllib3 to fully decode a small amount of highly compressed data in a single operation. This can result in excessive resource consumption (high CPU usage and massive memory allocation for the decompressed data; CWE-409) on the client side, even if the application only requested a small chunk of data.

Affected usages

Applications and libraries using urllib3 version 2.5.0 and earlier to stream large compressed responses or content from untrusted sources.

stream(), read(amt=256), read1(amt=256), read_chunked(amt=256), readinto(b) are examples of urllib3.HTTPResponse method calls using the affected logic unless decoding is disabled explicitly.

Remediation

Upgrade to at least urllib3 v2.6.0 in which the library avoids decompressing data that exceeds the requested amount.

If your environment contains a package facilitating the Brotli encoding, upgrade to at least Brotli 1.2.0 or brotlicffi 1.2.0.0 too. These versions are enforced by the urllib3[brotli] extra in the patched versions of urllib3.

Credits

The issue was reported by @Cycloctane. Supplemental information was provided by @stamparm during a security audit performed by 7ASecurity and facilitated by OSTIF.

Affected versions

PyPI

PackageVulnerableFixed in
urllib3
>= 1.0, < 2.6.0
2.6.0
urllib3
>= 1.0, < 2.6.0
2.6.0

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

urllib3 PyPI → 2.6.0

pip
pip install --upgrade "urllib3>=2.6.0"
poetry
poetry add "urllib3>=2.6.0"
uv
uv add "urllib3>=2.6.0"

Severity breakdown

CVSS 4.0 8.9

CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:H

Attack vector
Network
Attack complexity
Low
Attack requirements
Present
Privileges required
None
User interaction
None
Confidentiality (vulnerable system)
None
Integrity (vulnerable system)
None
Availability (vulnerable system)
High
Confidentiality (subsequent systems)
None
Integrity (subsequent systems)
None
Availability (subsequent systems)
High

CVSS 3.1 7.5

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

Weakness

CWE-409: Improper Handling of Highly Compressed Data (Data Amplification)

The product does not handle or incorrectly handles a compressed input with a very high compression ratio that produces a large output.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-vxq7-64xx-v4gw
urllib3: HTTPResponse.stream()/read_chunked() buffers an unbounded chunk-size line into memory
High Also affects urllib3
GHSA-gh4c-6fx4-qh6g
urllib3: Chunked Deflate streaming can enter an infinite loop
Medium Also affects urllib3
GHSA-8988-9cw3-xx77
urllib3: HTTPS proxy TLS configuration may be ignored or overridden
High Also affects urllib3
GHSA-mf9v-mfxr-j63j
urllib3: Decompression-bomb safeguards bypassed in parts of the streaming API
High Also affects urllib3
GHSA-qccp-gfcp-xxvc
urllib3: Sensitive headers forwarded across origins in proxied low-level redirects
High Also affects urllib3
GHSA-38jv-5279-wg99
Decompression-bomb safeguards bypassed when following HTTP redirects (streaming API)
High Also affects urllib3
GHSA-gm62-xv2j-4w53
urllib3 allows an unbounded number of links in the decompression chain
High Also affects urllib3
GHSA-48p4-8xcf-vxj5
urllib3 does not control redirects in browsers and Node.js
Medium Also affects urllib3

Credits: Chi-Song-Owen, Cycloctane, illia-v, pquentin, sethmlarson, stamparm

Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor