CVE-2026-128127
Base64 multipart decoding can overread memory, bypassing client_max_size.
- CVSS 8.7
- CWE-400
- Resource Management
- Remote
AIOHTTP is an asynchronous HTTP client/server framework for asyncio and Python. Prior to 3.14.4, BodyPartReader.read_chunk() processing a multipart part with Content-Transfer-Encoding set to base64 keeps reading until the chunk length is a multiple of four without enforcing a byte limit. A short Content-Length or a long run of whitespace can cause one call to read the remaining body into memory before the size check or spin on the event loop. A remote attacker can send such a multipart request to a handler that reads multipart data and bypass client_max_size. This issue is fixed in version 3.14.4.
- CWE
- CWE-400
- CVSS base score
- 8.7
- Published
- 2026-11-13
- OWASP
- A04 Insecure Design
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- aiohttp
- Fixed by upgrading
- Yes
Solution
Upgrade aiohttp to version 3.14.4 or later.
Vulnerable code sample
import aiohttp
from aiohttp import web
async def handle(request: web.Request) -> web.Response:
# VULNERABLE: reads multipart body without enforcing size limit
reader = await request.multipart()
parts = []
async for part in reader:
# part.headers may contain Content-Transfer-Encoding: base64
# The following call reads the entire remaining body if the
# encoded length is not a multiple of four, ignoring client_max_size.
data = await part.read_chunk() # type: ignore[arg-type]
parts.append(data)
return web.Response(text=f"Received {len(parts)} parts")Patched code sample
import aiohttp
from aiohttp import web
async def handle(request: web.Request) -> web.Response:
# FIX: enforce size limit when reading multipart parts
reader = await request.multipart()
parts = []
async for part in reader:
# Limit reads to the request's client_max_size to prevent exhaustion
max_size = request.app['client_max_size']
data = await part.read_chunk(max_size) # type: ignore[arg-type]
parts.append(data)
return web.Response(text=f"Received {len(parts)} parts")Published 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 multipart base64 edge cases (#13509) (aio-libs/aiohttp)
aiohttp/multipart.py,aiohttp/multipart.py · BodyPartReader.read_chunk,aiohttp/multipart.py · BodyPartReader.__init__ - [PR #13509/2d9c5c10 backport][3.14] Fix multipart base64 edge cases (#13513) (aio-libs/aiohttp)
aiohttp/multipart.py · BodyPartReader.__init__
Cite this entry
@misc{vaitp:cve2026128127,
title = {{Base64 multipart decoding can overread memory, bypassing client_max_size.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-128127},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-128127/}}
}
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 ::
