Urgent.News

What's breaking now, across thousands of outlets.

Editions

Tech

The /sdp endpoint that trusted its callers: fixing a memory-amplification DoS in py-libp2p

This is a submission for DEV's Summer Bug Smash: Clear the Lineup powered by Sentry . Project Overview py-libp2p is the Python implementation of libp2p — the peer-to-peer networking stack that underpins IPFS, Filecoin, and Ethereum-class nodes. I've been working on its WebRTC-Direct transport, which lets two peers connect without a certificate authority: the peer's multiaddr carries a hash of its…

The py-libp2p project, which implements the libp2p peer-to-peer networking stack for Python, contains a web-based Transport called WebRTC-Direct. This allows two peers to connect directly without a certificate authority, using multiaddr hashes and DTLS handshakes. Before establishing an encrypted connection, the two peers exchange SDP offer/answer packets. Until the STUN-based listener is implemented (issue #1352), a minimal dev harness in py-libp2p handles this exchange via an HTTP server listening on the /sdp endpoint.

The vulnerability was found in the POST /sdp handler, which took the caller's Content-Length header and buffered the exact number of bytes without any upper bound. The body, headers, and decoded header values were all stored in memory, leading to a memory-amplification Denial of Service (DoS) attack. The attacker could control the size of the request body and headers, causing the memory usage to grow arbitrarily large.

The handler also lacked a timeout, enabling an attacker to continuously send header lines and never terminate the loop.

A reproduction harness was built to test the vulnerability, showing that a malicious 4 MiB request could cause the memory usage to peak at 1,113 MiB. After applying the fix, the memory usage remained minimal, even with a 1 GiB malicious request. The fix introduces three bounded constants: _MAX_SDP_BODY_SIZE (32 KiB), _MAX_HEADER_LINES (64), and _MAX_HEADER_BYTES (8 KiB) to prevent memory-amplification DoS attacks on the /sdp endpoint.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

The test was green. Every real connection would have failed.

This is a submission for DEV's Summer Bug Smash: Smash Stories powered by Sentry . The setting WebRTC-Direct in libp2p has a neat trick for connecting without a certificate authority: the peer's…

  • Code in DEV Summer Bug Smash involved WebRTC-Direct in libp2p
  • RTCConfiguration certificate handling incorrect in aiortc ≥ 1.5
  • Fix involved setting mangled certificates attribute directly

Week 20 building Convertify: the blog post I did not write

The temptation Query cluster around " AVIF vs WebP vs HEIC 2026 " is competitive and valuable. My blog id 1 covers it, published months ago, indexed, gets a small trickle of clicks.

  • Team focused on improving existing blog post without creating new one
  • Addressed 30 MB PNG bug, determined no actual bug present
  • Observed 77% week-over-week increase in traffic on Google

More from Thursday 20 August →