CVE-2026-97688
Infinite loop in urllib3 HTTPResponse when decoding chunked deflate data
- CVSS 6.9
- CWE-835
- Resource Management
- Remote
urllib3 is an HTTP client library for Python. From 2.6.2 until 2.8.0, HTTPResponse.stream and HTTPResponse.read_chunked can enter an infinite loop because the Deflate decoder retains trailing bytes as unconsumed input after reaching end-of-stream and repeatedly decodes them without progress. The issue occurs when an untrusted server sends a chunked Deflate response whose decoded body exceeds a positive finite chunk size and whose encoded body has trailing bytes, specifically a response with Transfer-Encoding: chunked and Content-Encoding: deflate, content decoding enabled, and the positive finite amt=N streaming chunk size. The attack mechanism is that a malicious server returns a compressed chunked response with trailing bytes after the Deflate stream. The impact is excessive CPU usage and a request that does not complete, and network read timeouts do not interrupt the loop because no further socket read occurs. This issue is fixed in version 2.8.0.
- CWE
- CWE-835
- CVSS base score
- 6.9
- Published
- 2026-09-29
- OWASP
- A04 Insecure Design
- Orthogonal defect classification
- Timing/Serialization
- Code defect classification
- Timing Issues
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- urllib3
- Fixed by upgrading
- Yes
Solution
Upgrade urllib3 to version 2.8.0 (or later).
Vulnerable code sample
import urllib3
def fetch(url):
http = urllib3.PoolManager()
resp = http.request('GET', url, preload_content=False)
# VULNERABLE: streaming deflate content can loop indefinitely
for chunk in resp.stream(amt=1024):
process(chunk)
def process(data):
# placeholder for processing logic
passPatched code sample
import urllib3
import zlib
def fetch(url):
http = urllib3.PoolManager()
resp = http.request('GET', url, preload_content=False)
# FIX: disable automatic deflate decoding to avoid infinite loop
resp.decode_content = False
decompressor = zlib.decompressobj(-zlib.MAX_WBITS)
for chunk in resp.stream(amt=1024):
data = decompressor.decompress(chunk)
if data:
process(data)
def process(data):
# placeholder for processing logic
passPublished fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Merge commit from fork (urllib3/urllib3)
src/urllib3/response.py · DeflateDecoder.decompress,src/urllib3/response.py · DeflateDecoder.has_unconsumed_tail
Cite this entry
@misc{vaitp:cve202697688,
title = {{Infinite loop in urllib3 HTTPResponse when decoding chunked deflate data}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-97688},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-97688/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
