CVE-2026-61541
Zapros <0.14.0 allows DoS via excessive chained Content‑Encoding layers.
- CVSS 6.9
- CWE-770
- Resource Management
- Remote
Zapros, a Python HTTP client, prior to version 0.14.0 is vulnerable to denial of service when an application requests content from an untrusted server, or follows a redirect to one, because a malicious response containing an excessive number of chained `Content-Encoding` values causes Zapros to construct a deeply nested decompression chain that consumes excessive resources. Version 0.14.0 patches the vulnerability by limiting responses to five content-encoding layers and raising `DecodingError` when that limit is exceeded. As a workaround, applications can add response middleware that inspects the `Content-Encoding` header and rejects responses containing more than a safe number of encoding layers.
- CWE
- CWE-770
- CVSS base score
- 6.9
- Published
- 2026-09-21
- 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
- Zapros
- Fixed by upgrading
- Yes
Solution
Upgrade Zapros to version 0.14.0 (or later).
Vulnerable code sample
import zapros
from zapros.exceptions import DecodingError
def fetch(url: str) -> bytes:
"""
Fetches content from `url` using Zapros without limiting
the number of content‑encoding layers.
"""
client = zapros.Client()
response = client.get(url)
# VULNERABLE: unbounded decoding chain allows resource exhaustion
encodings = response.headers.get('Content-Encoding', '').split(',')
body = response.body
for enc in encodings:
enc = enc.strip().lower()
if enc == 'gzip':
body = zapros.decoders.gzip_decode(body)
elif enc == 'deflate':
body = zapros.decoders.deflate_decode(body)
elif enc == 'br':
body = zapros.decoders.brotli_decode(body)
# additional encodings may be added here
return bodyPatched code sample
import zapros
from zapros.exceptions import DecodingError
def fetch(url: str) -> bytes:
"""
Fetches content from `url` using Zapros, limiting the number of
content‑encoding layers to prevent resource exhaustion.
"""
client = zapros.Client()
response = client.get(url)
# FIX: enforce a maximum of 5 encoding layers
encodings = [e.strip().lower() for e in response.headers.get('Content-Encoding', '').split(',') if e]
if len(encodings) > 5:
raise DecodingError("Too many Content-Encoding layers")
body = response.body
for enc in encodings:
if enc == 'gzip':
body = zapros.decoders.gzip_decode(body)
elif enc == 'deflate':
body = zapros.decoders.deflate_decode(body)
elif enc == 'br':
body = zapros.decoders.brotli_decode(body)
return bodyPublished 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.
- fix(security): limit Content-Encoding layers to 5 (kap-sh/zapros)
src/zapros/_models.py,src/zapros/_models.py · Response._get_content_decoder
Cite this entry
@misc{vaitp:cve202661541,
title = {{Zapros <0.14.0 allows DoS via excessive chained Content‑Encoding layers.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-61541},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-61541/}}
}
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 ::
