CVE-2026-21441: urllib3 vulnerable to decompression-bomb safeguard bypass when following HTTP redirects (streaming API)
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.
urllib3 can perform decoding or decompression based on the HTTP Content-Encoding header (e.g., gzip, deflate, br, or zstd). When using the streaming API, the library decompresses only the necessary bytes, enabling partial content consumption.
However, for HTTP redirect responses, the library would read the entire response body to drain the connection and decompress the content unnecessarily. This decompression occurred even before any read methods were called, and configured read limits did not restrict the amount of decompressed data. As a result, there was no safeguard against decompression bombs. A malicious server could exploit this to trigger excessive resource consumption on the client (high CPU usage and large memory allocations for decompressed data; CWE-409).
Affected usages
Applications and libraries using urllib3 version 2.6.2 and earlier to stream content from untrusted sources by setting preloadcontent=False when they do not disable redirects.
Remediation
Upgrade to at least urllib3 v2.6.3 in which the library does not decode content of redirect responses when preloadcontent=False.
If upgrading is not immediately possible, disable redirects by setting redirect=False for requests to untrusted source.
Other sources
urllib3 is an HTTP client library for Python. 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. urllib3 can perform decoding or decompression based on the HTTP Content-Encoding header (e.g., gzip, deflate, br, or zstd). When using the streaming API, the library decompresses only the necessary bytes, enabling partial content consumption. Starting in version 1.22 and prior to version 2.6.3, for HTTP redirect responses, the library would read the entire response body to drain the connection and decompress the content unnecessarily. This decompression occurred even before any read methods were called, and configured read limits did not restrict the amount of decompressed data. As a result, there was no safeguard against decompression bombs. A malicious server could exploit this to trigger excessive resource consumption on the client. Applications and libraries are affected when they stream content from untrusted sources by setting preloadcontent=False when they do not disable redirects. Users should upgrade to at least urllib3 v2.6.3, in which the library does not decode content of redirect responses when preloadcontent=False. If upgrading is not immediately possible, disable redirects by setting redirect=False for requests to untrusted source.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/urllib3to a version that resolves this vulnerability.Fixed in 2.6.3 - Upgrade
Upgrade
urllib3to a version that resolves this vulnerability.Fixed in 2.6.3 - Configuration
When streaming from untrusted sources and you do not disable redirects, set preload_content=False as described; however, to avoid the decompression-bomb safeguard bypass on redirects, also disable redirects (see redirect=False action).
urllib3 preload_content = False - Configuration
If upgrading is not immediately possible, disable redirects for requests to untrusted sources by setting redirect=False, especially when using preload_content=False.
urllib3 redirect = False
Event History
Frequently Asked Questions
What is the severity of CVE-2026-21441?
CVE-2026-21441 is classified as a medium severity vulnerability.
How do I fix CVE-2026-21441?
To fix CVE-2026-21441, upgrade urllib3 to version 2.6.3 or later.
What versions of urllib3 are affected by CVE-2026-21441?
CVE-2026-21441 affects urllib3 versions from 1.22 up to 2.6.2.
What is the nature of the vulnerability in CVE-2026-21441?
CVE-2026-21441 involves a flaw in the streaming API of urllib3 that may lead to excessive memory use during handling of large HTTP responses.
Is there a known exploit for CVE-2026-21441?
As of now, there are no publicly known exploits specifically targeting CVE-2026-21441.