Feb 12, 2026·6 min read·105 visits
Pion DTLS used random numbers for AES-GCM nonces instead of counters. Due to the Birthday Paradox, this leads to collisions in long sessions. A collision breaks AES-GCM security completely (key recovery + forgery). Fixed in v3.1.0 by using sequence numbers.
A fundamental cryptographic flaw in Pion DTLS (versions prior to v3.1.0) exposes AES-GCM encrypted sessions to the 'Forbidden Attack' (nonce reuse). By relying on random values for the explicit nonce rather than a strict counter, the library falls victim to the Birthday Paradox. In high-volume sessions, this guarantees a nonce collision, allowing attackers to recover the authentication key, forge packets, and potentially decrypt traffic.
If you are building a WebRTC application in Go, you are almost certainly using Pion. It is the gold standard, the heavy lifter, the 'Gopher in the room' for real-time communication. From cloud gaming to suspicious video chat apps, Pion handles the handshake and the transport.
But here is the thing about DTLS (Datagram Transport Layer Security): it is just TLS over UDP. And UDP means packets get lost, reordered, or duplicated. This makes the cryptographic state machine a nightmare to manage compared to the nice, orderly stream of TCP. Developers often take shortcuts to handle this chaos.
In CVE-2026-26014, the shortcut was randomness. Specifically, how the library generated the 'nonce' (number used once) for AES-GCM encryption. The developers trusted crypto/rand to keep them safe. It is a common mistake: assuming that if a number is random enough and big enough, it will never repeat. Spoiler alert: Probability theory hates your assumptions.
Let's talk about AES-GCM. It is an AEAD (Authenticated Encryption with Associated Data) cipher. It requires a unique nonce for every single invocation with the same key. If you reuse a nonce, even once, the security guarantees of GCM collapse faster than a house of cards in a hurricane.
The DTLS 1.2 spec (RFC 5288) defines the GCM nonce as 12 bytes: 4 bytes of fixed 'salt' and 8 bytes of 'explicit' nonce sent with the packet. Pion implemented the explicit part by generating 8 random bytes.
Here is where the Birthday Paradox walks in and slaps you. You might think 64 bits (8 bytes) of randomness is massive. But the probability of a collision scales with the square root of the space size. With $2^{64}$ possibilities, you reach a 50% chance of collision after roughly $2^{32}$ packets (about 4.2 billion).
> [!WARNING] > Wait, 4 billion packets? > That sounds like a lot, but in a high-bandwidth WebRTC video stream running 24/7 (like a security camera or a dedicated media server), hitting this number is not just possible; it is inevitable.
Once a collision occurs, an attacker observing the traffic sees two different packets encrypted with the same Key and Nonce. This is the cryptographic equivalent of dividing by zero.
Let's look at the code. This is where the 'random' decision was made. The developers likely chose this because tracking state in a UDP protocol is annoying—you have to handle sliding windows and out-of-order delivery.
The Vulnerable Code (Before v3.1.0):
// Inside the encryption routine
// explicitNonce is the 8-byte field
if _, err := rand.Read(explicitNonce); err != nil {
return nil, err
}
// ... Encrypt using this random nonce ...That rand.Read call is the fatal flaw. It is stateless. It does not know what it generated five milliseconds ago.
The Fix (Commit 61762dee8217991882c5eb79856b9e7a73ee349f):
The fix aligns Pion with RFC 9325, which mandates deterministic nonces based on the record sequence number. Since DTLS already tracks sequence numbers to prevent replay attacks, we can just use that.
// The new way: Deterministic Construction
// nonce[4:] is the 8-byte explicit part
// We combine the Epoch (2 bytes) and Sequence Number (6 bytes)
// to guarantee uniqueness for the life of the session.
seq64 := (uint64(pkt.Header.Epoch) << 48) | (pkt.Header.SequenceNumber & 0x0000ffffffffffff)
binary.BigEndian.PutUint64(nonce[4:], seq64)This change is beautiful in its simplicity. Epoch increments on re-handshake, and SequenceNumber increments on every packet. It is mathematically impossible to repeat a nonce unless the sequence number wraps around (which takes eons) or the implementation is broken elsewhere.
So, how do we weaponize this? We use Joux's Attack (the 'Forbidden Attack'). This is not a theoretical 'maybe we can decrypt one byte' attack. This is a 'we own the session' attack.
Ciphertext = Plaintext XOR Keystream.C1 XOR C2 = P1 XOR P2. We now know the XOR difference of the plaintexts. If the content is predictable (like standard RTP headers), we can recover the Keystream.Once we have $H$, we can forge valid authentication tags for any ciphertext. We can inject malicious video frames, terminate the session, or impersonate the server. We have effectively broken the integrity of the connection.
While the CVSS score is a moderate 5.9 (due to the high attack complexity—monitoring 4 billion packets takes time), the impact is catastrophic for affected sessions. For standard web browsing, this is negligible. for infrastructure-grade WebRTC (telehealth, surveillance, industrial control), it is a ticking time bomb.
github.com/pion/dtls, check your go.mod. If it says anything less than v3.1.0, you are vulnerable. go get github.com/pion/dtls/v3@v3.1.0.CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
Pion DTLS Pion | >= 1.0.0, < 3.1.0 | 3.1.0 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-327 |
| Attack Vector | Network (Passive/MITM) |
| CVSS v3.1 | 5.9 (Medium) |
| Impact | Key Recovery & Forgery |
| Key Cipher | AES-GCM |
| Collision Bound | ~2^32 Packets |
Use of a Broken or Risky Cryptographic Algorithm
NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.
CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.
CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.
CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.
A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.
CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.