VAITP Dataset

← Back to the dataset

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.

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.

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/}}
}

Download this entry as JSON Download the whole dataset

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 ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.