CVE-2025-66471: Urllib3 Urllib3 Streaming API Improperly Handles Vulnerability

HIGH
Advisory Identifier: GHSA-2xpw-w6gg-jr37
CWE-409
Published
Advisory Summary

CVE-2025-66471 is a HIGH urllib3 streaming api improperly handles vulnerability (CWE-409: Improper Handling of Highly Compressed Data (Data Amplification)) affecting Urllib3 libraries in the PyPI ecosystem. The issue involves urllib3 streaming api improperly handles highly compressed data. Remediation is available by upgrading affected packages to version 2.6.0.

CVE-2025-66471 at a Glance

CVE Identifier CVE-2025-66471
GHSA Identifier GHSA-2xpw-w6gg-jr37
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-409: Improper Handling of Highly Compressed Data (Data Amplification)
Affected Product Urllib3
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2025-66471

To remediate this vulnerability, upgrade all affected Urllib3 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

urllib3 fixed: 2.6.0
pip install urllib3>=2.6.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show urllib3

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2025-66471, inspect your installed packages using pip:

pip show urllib3

Analyze the terminal output to locate any version of Urllib3 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.6.0), your application is affected.

Note: The pip show urllib3 command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-409: Improper Handling of Highly Compressed Data (Data Amplification), where the product does not handle or incorrectly handles a compressed input with a very high compression ratio that produces a large output. In Urllib3, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact urllib3's [streaming API](https://urllib3.readthedocs.io/en/2.5.0/advanced-usage.html#streaming-and-i-o) 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](https://7asecurity.com/) and facilitated by [OSTIF](https://ostif.org/).

CVE-2025-66471 Affected Urllib3 Versions

1 component(s)
Fixed Versions:
2.6.0
Product / Package Ecosystem Affected Versions Fixed Version
urllib3
PyPI
≥ 1.0
< 2.6.0
2.6.0

References

Frequently Asked Questions

What is CVE-2025-66471?
CVE-2025-66471 is a security vulnerability in Urllib3 involving urllib3 streaming API improperly handles highly compressed data under CWE-409: Improper Handling of Highly Compressed Data (Data Amplification).
Which Urllib3 versions are affected?
Affected versions include releases prior to 2.6.0 across affected packages: urllib3.
What version fixes CVE-2025-66471?
Upgrading to 2.6.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is urllib3 affected?
Yes, urllib3 is affected in releases prior to 2.6.0. Upgrade your dependency to 2.6.0 or later.
What CWE is associated with CVE-2025-66471?
CVE-2025-66471 is classified under 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.).
How can I check PyPI dependencies for CVE-2025-66471?
Run the dependency tree command: 'pip show urllib3'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-2xpw-w6gg-jr37",
  "modified" : "2026-09-25T17:01:30Z",
  "published" : "2025-12-05T18:15:54Z",
  "aliases" : [ "CVE-2025-66471" ],
  "summary" : "urllib3 streaming API improperly handles highly compressed data",
  "details" : "### Impact\n\nurllib3's [streaming API](https://urllib3.readthedocs.io/en/2.5.0/advanced-usage.html#streaming-and-i-o) 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.\n\nWhen 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.\n\nThe 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.\n\n\n### Affected usages\n\nApplications and libraries using urllib3 version 2.5.0 and earlier to stream large compressed responses or content from untrusted sources.\n\n`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.\n\n\n### Remediation\n\nUpgrade to at least urllib3 v2.6.0 in which the library avoids decompressing data that exceeds the requested amount.\n\nIf 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.\n\n\n### Credits\n\nThe issue was reported by @Cycloctane.\nSupplemental information was provided by @stamparm during a security audit performed by [7ASecurity](https://7asecurity.com/) and facilitated by [OSTIF](https://ostif.org/).",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "urllib3"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0"
      }, {
        "fixed" : "2.6.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/urllib3/urllib3/security/advisories/GHSA-2xpw-w6gg-jr37"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-66471"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/urllib3/urllib3/commit/c19571de34c47de3a766541b041637ba5f716ed7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/urllib3/urllib3/commit/d0fde3672e4a4093f7587858dccfc298eb66e46c"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-2xpw-w6gg-jr37"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/urllib3/PYSEC-2026-1994.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/urllib3/urllib3"
  }, {
    "type" : "WEB",
    "url" : "https://pypi.org/project/urllib3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-409" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-12-05T18:15:54Z",
    "nvd_published_at" : "2025-12-05T17:16:04Z"
  }
}