VAITP Dataset

← Back to the dataset

CVE-2026-128132

Memory‑exhaustion via unbounded WebSocket frame parsing in aiohttp < 3.14.4.

  • 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, the WebSocket reader continues parsing frames already received after the receive queue pauses the transport, and empty messages are not counted toward the queue size. With permessage-deflate, one read of compressed frames can add many megabytes of decompressed messages to the receive queue. A remote peer can send many small or compressed messages faster than the application consumes them and cause excessive memory use in a server or client. This issue is fixed in version 3.14.4.

CVSS base score
8.7
Published
2026-11-13
OWASP
A06 Vulnerable and Outdated Components
Orthogonal defect classification
Timing/Serialization
Code defect classification
Serialization Issues
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: unbounded receive queue allows memory exhaustion
    async for msg in ws:
        if msg.type == WSMsgType.TEXT:
            # Echo back the message
            await ws.send_str(msg.data)
        elif msg.type == WSMsgType.ERROR:
            break

    await ws.close()
    return ws

app = web.Application()
app.router.add_get('/ws', websocket_handler)

Patched code sample

import asyncio
from aiohttp import web, WSMsgType

async def websocket_handler(request):
    # FIX: limit per-message size to prevent unbounded memory growth
    ws = web.WebSocketResponse(max_msg_size=2**20)  # 1 MiB
    await ws.prepare(request)

    async for msg in ws:
        if msg.type == WSMsgType.TEXT:
            await ws.send_str(msg.data)
        elif msg.type == WSMsgType.ERROR:
            break

    await ws.close()
    return ws

app = web.Application()
app.router.add_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.

  • 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_data and 4 more
  • Fix memory consumption on empty/small messages (#13393) (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/web_ws.py · WebSocketResponse.close, aiohttp/web_ws.py · WebSocketResponse._handle_ping_pong_exception, aiohttp/_websocket/reader_py.py · WebSocketDataQueue.feed_data, aiohttp/_websocket/reader_py.py · WebSocketDataQueue._read_from_buffer, aiohttp/_websocket/reader_py.py · WebSocketDataQueue.__init__
  • Fix memory consumption on empty/small messages (#13393) (#13545) (aio-libs/aiohttp)
    aiohttp/client.py · ClientSession._ws_connect

Cite this entry

@misc{vaitp:cve2026128132,
  title        = {{Memory‑exhaustion via unbounded WebSocket frame parsing in aiohttp < 3.14.4.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-128132},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-128132/}}
}

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.