CVE-2026-123817
AIOHTTP WebSocket can be forced into high memory use via fragmented frames.
- CVSS 8.7
- CWE-770
- Resource Management
- Remote
AIOHTTP is an asynchronous HTTP client/server framework for asyncio and Python. Prior to 3.14.4, the WebSocket reader retains one bytes object for each transport read while reassembling an incomplete frame. A malicious peer can split a frame into many tiny reads so per-object overhead substantially exceeds the payload bytes allowed by max_msg_size. The condition affects a server receiving frames from a malicious client and a client receiving frames from a malicious server, and can cause excessive memory consumption or denial of service. This issue is fixed in version 3.14.4.
- CWE
- CWE-770
- CVSS base score
- 8.7
- Published
- 2026-11-09
- OWASP
- A06 Vulnerable and Outdated Components
- Orthogonal defect classification
- Algorithm
- Code defect classification
- Incorrect Algorithm
- 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 asyncio
from aiohttp import web, WSMsgType
async def websocket_handler(request):
ws = web.WebSocketResponse()
await ws.prepare(request)
# VULNERABLE: accumulates each read fragment as a separate bytes object
fragments = [] # list of bytes objects
async for msg in ws:
if msg.type == WSMsgType.BINARY:
# each call may return a tiny slice of the original frame
fragments.append(msg.data)
# process when a complete logical message is detected
if len(fragments) > 0 and is_message_complete(fragments):
full_msg = b''.join(fragments)
await process_message(full_msg)
fragments.clear()
elif msg.type == WSMsgType.ERROR:
break
await ws.close()
return ws
def is_message_complete(frags):
# placeholder: assume a single fragment forms a complete message
return True
async def process_message(data):
# placeholder for message handling logic
pass
app = web.Application()
app.add_routes([web.get('/ws', websocket_handler)])Patched code sample
import asyncio
from aiohttp import web, WSMsgType
async def websocket_handler(request):
ws = web.WebSocketResponse()
await ws.prepare(request)
# FIX: reuses a single mutable buffer to avoid per-fragment bytes objects
buffer = bytearray()
async for msg in ws:
if msg.type == WSMsgType.BINARY:
buffer.extend(msg.data)
if is_message_complete(buffer):
await process_message(bytes(buffer))
buffer.clear()
elif msg.type == WSMsgType.ERROR:
break
await ws.close()
return ws
def is_message_complete(buf):
# placeholder: assume buffer holds a complete message when non‑empty
return len(buf) > 0
async def process_message(data):
# placeholder for message handling logic
pass
app = web.Application()
app.add_routes([web.get('/ws', websocket_handler)])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.
- Limit number of queued WS fragments (#13352) (#13355) (aio-libs/aiohttp)
aiohttp/_websocket/reader_py.py · WebSocketReader._feed_data,aiohttp/_websocket/reader_py.py · WebSocketReader.__init__ - Fix memory consumption on empty/small messages (#13393) (#13545) (#13546) (aio-libs/aiohttp)
aiohttp/client.py · ClientSession._ws_connect,aiohttp/client_ws.py,aiohttp/client_ws.py · ClientWebSocketResponse.close,aiohttp/client_ws.py · ClientWebSocketResponse.receive#4,aiohttp/client_ws.py · ClientWebSocketResponse._handle_ping_pong_exception,aiohttp/client_ws.py · ClientWebSocketResponse.__init__,aiohttp/web_ws.py,aiohttp/web_ws.py · WebSocketResponse.close,aiohttp/web_ws.py · WebSocketResponse._handle_ping_pong_exception,aiohttp/web_ws.py · WebSocketResponse._post_start,aiohttp/_websocket/reader_py.py,aiohttp/_websocket/reader_py.py · WebSocketDataQueue.feed_dataand 4 more - Fix limit on message tail (#13501) (#13511) (aio-libs/aiohttp)
aiohttp/web_protocol.py,aiohttp/web_protocol.py · RequestHandler.data_received,aiohttp/web_protocol.py · RequestHandler.finish_response,aiohttp/web_protocol.py · RequestHandler.set_parser,aiohttp/web_protocol.py · RequestHandler._resume_msg_queue_reading,aiohttp/web_protocol.py · RequestHandler.__init__ - [PR #13356/72eaa429 backport][3.14] Stop handing back pipelined requests the parser buffered (#13360) (aio-libs/aiohttp)
aiohttp/http_parser.py · HttpParser.feed_data,aiohttp/web_protocol.py · RequestHandler.finish_response - [PR #13738/8b010057 backport][3.14] Add client_max_fields option to Application (#13741) (aio-libs/aiohttp)
aiohttp/web_app.py,aiohttp/web_app.py · Application._make_request,aiohttp/web_app.py · Application.__init__,aiohttp/web_request.py,aiohttp/web_request.py · BaseRequest.clone,aiohttp/web_request.py · BaseRequest.post,aiohttp/web_request.py · BaseRequest.__init__,aiohttp/web_request.py · Request.clone - [PR #13930/b1f6c87b backport][3.14] Add limits for client cookie handling (#13942) (aio-libs/aiohttp)
aiohttp/client.py,aiohttp/client.py · ClientSession._request,aiohttp/cookiejar.py,aiohttp/cookiejar.py · CookieJar.clear,aiohttp/cookiejar.py · CookieJar.filter_cookies,aiohttp/cookiejar.py · CookieJar.load,aiohttp/cookiejar.py · CookieJar.update_cookies_from_headers,aiohttp/cookiejar.py · CookieJar._delete_cookies,aiohttp/cookiejar.py · CookieJar._do_expiration,aiohttp/cookiejar.py · CookieJar._load_json_data,aiohttp/cookiejar.py · CookieJar._update_cookies,aiohttp/cookiejar.py · CookieJar.__init__and 5 more - Patchback/backports/3.14/2a84c9ba7083870297eaee8d86ef4a36413d1b00/pr 13488 (#13612) (aio-libs/aiohttp)
aiohttp/_websocket/reader_py.py · WebSocketReader._feed_data,aiohttp/_websocket/reader_py.py · WebSocketReader.__init__ - [PR #13415/8c8906a1 backport][3.14] Fix oversized frames on websocket messages (#13494) (aio-libs/aiohttp)
aiohttp/_websocket/reader_py.py · WebSocketReader._feed_data - [PR #13509/2d9c5c10 backport][3.14] Fix multipart base64 edge cases (#13513) (aio-libs/aiohttp)
aiohttp/multipart.py,aiohttp/multipart.py · BodyPartReader.read_chunk,aiohttp/multipart.py · BodyPartReader.__init__ - Improve performance of domain matching (#13943) (#13945) (aio-libs/aiohttp)
aiohttp/web_urldispatcher.py,aiohttp/web_urldispatcher.py · MaskDomain.canonical,aiohttp/web_urldispatcher.py · MaskDomain.match_domain,aiohttp/web_urldispatcher.py · MaskDomain.__init__ - [PR #13362/d041d4d0 backport][3.14] Fix excessive CPU use on decompressing small members (#13391) (aio-libs/aiohttp)
aiohttp/compression_utils.py,aiohttp/compression_utils.py · ZLibDecompressor.decompress_sync,aiohttp/compression_utils.py · ZLibDecompressor.__init__,aiohttp/compression_utils.py · ZSTDDecompressor.data_available,aiohttp/compression_utils.py · ZSTDDecompressor.decompress_sync,aiohttp/compression_utils.py · ZSTDDecompressor.__init__,aiohttp/_websocket/reader_py.py,aiohttp/_websocket/reader_py.py · WebSocketReader._handle_frame
Cite this entry
@misc{vaitp:cve2026123817,
title = {{AIOHTTP WebSocket can be forced into high memory use via fragmented frames.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-123817},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-123817/}}
}
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 ::
