79% vs 51%: independent neobanks lag on app security. Read the report

Deep Dive

Deep Dive

ntop n2n Supernode RCE via REGISTER_SUPER_NAK (CVE-2026-136404)

n2n 3.0 to 3.1.1 copies a 16-bit token size into a 48-byte stack buffer, allowing unauthenticated crashes and possible code execution; the fix is only in git.

TL;DR

  • n2n's supernode trusts a 16-bit token size from REGISTER_SUPER packets. The decoder copies that many bytes into fixed-size stack buffers without checking the destination.
  • Every n2n release from 3.0 through 3.1.1 is affected, including the current 3.1.1 release from 2022. The fix is merged in the development branch but no tagged release contains it.
  • The CVE record rates CVE-2026-136404 at CVSS v4.0 9.3 Critical. No public exploit or in-the-wild use is known, and the CVE is not in CISA KEV as of 2026-11-25.
  • Build the supernode and edge from the fix commit, or apply commit 854fbbe01bbf to your source tree. See "How do I fix it?" for the package-manager situation.

Am I affected?

You are exposed when an n2n supernode built from an affected release listens on a UDP port that an attacker can reach. The attacker must also be able to send packets for a community the supernode serves. The CVE record gives CVSS v4.0 9.3, CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N.

All of these conditions must hold:

  • The supernode runs n2n 3.0, 3.1.0 or 3.1.1.
  • The supernode's UDP port is reachable from the attacker's network position.
  • The supernode serves a community the attacker can name. n2n communities can be open, and a community with a known or empty password is reachable.
  • The attacker can send a REGISTER_SUPER_NAK, REGISTER_SUPER, UNREGISTER_SUPER or REGISTER_SUPER_ACK packet to that port.

The affected code is the packet decoder shared by the supernode and the edge. A compromised or malicious edge can also send the packet to a supernode it has joined.

Branch Affected versions Fixed version
n2n 3.x 3.0, 3.1.0, 3.1.1 No release; fix commit 854fbbe01bbf on the dev branch
n2n 2.x and earlier All releases Not listed as affected; upgrade to a fixed 3.x build

Check the installed version with the package manager, or ask the binary to print its banner:

supernode -h 2>&1 | head -1
dpkg-query -W -f='${Version}\n' n2n
apk info -v n2n
opkg list-installed n2n

Debian 13 ships n2n 1.3.1, which is outside the affected range. Debian testing and unstable ship 3.1.1, which is affected.

Container images have the same problem. Images on Docker Hub are often maintained by third parties whose tags may lag the source. Check the binary banner inside the running container rather than the image tag.

How do I fix it?

No tagged n2n release contains the fix. Build from the development branch until a release appears, or carry the commit in your distribution package.

  1. Fetch the fix commit and build both binaries:
git clone https://github.com/ntop/n2n.git
cd n2n
git checkout 854fbbe01bbf131bf4cb88f8450d7084267668e1
./autogen.sh
./configure
make
sudo make install
  1. Rebuild the supernode and every edge from that tree. Both binaries run the four vulnerable decoders, so an edge built from an affected release can itself be overflowed when a malicious supernode answers it with a crafted REGISTER_SUPER_ACK or REGISTER_SUPER_NAK.
  2. Restart the supernode and confirm its version banner reports the build you installed.

If you cannot rebuild, restrict the supernode's UDP port to known edges with a firewall rule and monitor the process for crashes. The fix commit also bounds the count field in REGISTER_SUPER_ACK, so a rule that only filters REGISTER_SUPER_NAK leaves the other decoders exposed.

Distribution packages need the same treatment. A package that still points at the 3.1.1 tarball does not carry the commit, even if the package version looks current. Ask the distribution to backport 854fbbe01bbf, or build the package from the fixed source and pin it in your repository.

What is the root cause?

n2n encodes authentication data in a fixed-size structure. The structure reserves 48 bytes for the token and stores the token length in a 16-bit field next to it:

#define N2N_AUTH_MAX_TOKEN_SIZE          48  /* max token size in bytes */

typedef struct n2n_auth {
    uint16_t        scheme;                         /* What kind of auth */
    uint16_t        token_size;                     /* Size of auth token */
    uint8_t         token[N2N_AUTH_MAX_TOKEN_SIZE]; /* Auth data interpreted based on scheme */
} n2n_auth_t;

decode_buf() is a general helper that copies a requested number of bytes from the packet into a caller-supplied buffer. It checks that the packet still holds that many bytes, but it does not check that the requested length fits the destination:

int decode_buf (uint8_t * out,
                size_t bufsize,
                const uint8_t * base,
                size_t * rem,
                size_t * idx) {

    if(*rem < bufsize) {
        return 0;
    }

    memcpy(out, (base + *idx), bufsize);
    *idx += bufsize;
    *rem -= bufsize;

    return bufsize;
}

decode_REGISTER_SUPER_NAK() reads token_size from the packet and passes it directly as the length:

retval += decode_uint16(&(nak->auth.scheme), base, rem, idx);
retval += decode_uint16(&(nak->auth.token_size), base, rem, idx);
retval += decode_buf(nak->auth.token, nak->auth.token_size, base, rem, idx);

A token_size above 48 makes decode_buf copy that many bytes into the 48-byte token array, which is a stack buffer inside the decoder. The 16-bit field allows up to 65535, but decode_buf refuses to copy more bytes than the packet still holds, so the size of one UDP datagram, at most 65507 bytes of payload, bounds the copy. The same pattern appears in decode_REGISTER_SUPER(), decode_UNREGISTER_SUPER() and decode_REGISTER_SUPER_ACK(). The acknowledgement decoder also trusts an 8-bit num_sn field for the backup-supernode list.

The same decode_buf helper serves every message type that carries authentication data, and that is why the fix touches four functions rather than one. The REGISTER_SUPER decoder handles the initial edge registration. The UNREGISTER_SUPER decoder handles a clean leave. The REGISTER_SUPER_ACK decoder carries the supernode's answer, including the list of backup supernodes. The REGISTER_SUPER_NAK decoder carries a refusal.

Each one reads a token length from the packet, and each one copies the token into a fixed array.

How is it exploited?

The attack is a single crafted UDP packet to the supernode. It needs no credentials beyond membership of a community the supernode serves.

  1. The attacker identifies an n2n supernode and a community it serves. A community with a password the attacker knows, or an open community, is enough.
  2. The attacker sends a REGISTER_SUPER_NAK packet whose auth.token_size field is larger than 48.
  3. The supernode calls decode_REGISTER_SUPER_NAK() on the packet. decode_buf() sees enough bytes in the packet and copies token_size bytes into the 48-byte stack buffer.
  4. The copy overwrites the saved stack canary and the return address. The CVE record describes using the oversized length to leak canaries and pointers, then overwrite the return address.
  5. The supernode crashes, or the attacker redirects execution when the function returns.

The CVE record describes the leak and the overwrite. It publishes no proof-of-concept code, and no public exploit is known.

The attacker does not need a large packet: a token a few hundred bytes long already overflows the 48-byte array and fits in one ordinary datagram. The community name is read from the common header before the token, and the supernode looks up the community before it decodes the token. The length field is therefore reached whenever the community exists, without a valid edge identity.

How does the attack flow?

An unauthenticated packet sets a length field larger than the destination, the decoder copies that many bytes onto the stack, and the supernode crashes or returns into attacker-chosen code.

flowchart LR A["Attacker sends a REGISTER_SUPER_NAK packet"] --> B["decode_REGISTER_SUPER_NAK reads token_size from the wire"] B --> C["decode_buf copies token_size bytes with no destination bound"] C --> D["memcpy overflows the 48-byte auth.token stack buffer"] D --> E["Stack canary and return address are overwritten"] E --> F["Supernode crashes or runs attacker code"]

What can an attacker do?

The minimum impact is a crash of the supernode, which takes the overlay network down for every edge that depends on it. The CVE record goes further and describes leaking stack canaries and pointers, then overwriting the return address to execute code.

Several conditions decide the outcome:

  • The attacker must reach the supernode's UDP port.
  • The attacker must name a community the supernode serves.
  • The supernode must run a build without stack-protector coverage on the decoder, or the attacker must first leak the canary.
  • The build and platform decide whether a leaked pointer is enough to bypass address randomization.

The record does not name a platform or a build where code execution was demonstrated. Treat remote code execution as described but not publicly proven, and treat denial of service as demonstrated by the overflow itself.

An attacker who can reach a supernode usually learns its community from the edge configuration or from traffic. n2n communities are identified by a name and an optional password. A supernode that serves several communities decodes a packet for any of them before it decides whether the sender is a known edge. That ordering is what makes the decoder reachable without a valid edge identity.

Why does the fix work?

The fix bounds every length read from the wire before the copy. It adds a check for token_size against N2N_AUTH_MAX_TOKEN_SIZE in the four decoders, and a check for num_sn against the acknowledgement payload space:

@@ -463,6 +463,11 @@ int decode_REGISTER_SUPER (n2n_REGISTER_SUPER_t *reg,
     retval += decode_uint16(&(reg->auth.scheme), base, rem, idx);
     retval += decode_uint16(&(reg->auth.token_size), base, rem, idx);
+    /* token_size is read from the wire; bound it to the fixed-size
+     * destination field auth.token before copying. */
+    if(reg->auth.token_size > N2N_AUTH_MAX_TOKEN_SIZE) {
+        return -1;
+    }
     retval += decode_buf(reg->auth.token, reg->auth.token_size, base, rem, idx);
@@ -603,10 +613,20 @@ int decode_REGISTER_SUPER_ACK (n2n_REGISTER_SUPER_ACK_t *reg,
     retval += decode_uint16(&(reg->auth.token_size), base, rem, idx);
+    if(reg->auth.token_size > N2N_AUTH_MAX_TOKEN_SIZE) {
+        return -1;
+    }
     retval += decode_buf(reg->auth.token, reg->auth.token_size, base, rem, idx);
     retval += decode_uint8(&(reg->num_sn), base, rem, idx);
+    if((size_t)reg->num_sn * REG_SUPER_ACK_PAYLOAD_ENTRY_SIZE > REG_SUPER_ACK_PAYLOAD_SPACE) {
+        return -1;
+    }
     retval += decode_buf(tmpbuf, (reg->num_sn * REG_SUPER_ACK_PAYLOAD_ENTRY_SIZE), base, rem, idx);

The checks reject any packet whose declared length cannot fit its destination, so decode_buf only receives lengths the caller can hold. A conforming peer never sends a larger value, so normal traffic is unaffected. The commit covers the four decoders that pass a wire-controlled length to the helper.

The fix is complete for the decoders it touches. It does not change decode_buf() itself, so any future caller that passes an untrusted length can reintroduce the same flaw.

How do I check if I was compromised?

No indicators of compromise are published. The overflow either crashes the process or gives the attacker code execution, and neither leaves a distinctive application log entry.

Check whether the supernode has crashed or restarted unexpectedly:

journalctl -u supernode --since "30 days ago" | grep -iE "segfault|core dumped|started"
coredumpctl list | grep supernode

Review packet captures for a REGISTER_SUPER-family packet whose auth token length field is larger than 48. A capture that predates the attack is not available on most deployments, so absence of evidence is not evidence of safety.

Timeline

  • 2022-03-31: n2n 3.1.1 is released, the last tagged release before the fix.
  • 2026-06-22: Pull request 1243 merges commit 854fbbe01bbf into the dev branch.
  • 2026-11-24: The CVE record for CVE-2026-136404 is published with CVSS v4.0 9.3.

The fix landed four years after the last release and five months before the CVE
Figure 1: n2n 3.1.1 shipped on 2022-03-31, the bounds checks merged on 2026-06-22 and the CVE followed on 2026-11-24. Source: n2n releases, pull request 1243 and the CVE record, checked November 25, 2026

FAQ

Is the Debian package affected?

It depends on the suite. Debian 13 ships n2n 1.3.1, which is outside the 3.0 to 3.1.1 range. Debian testing and unstable ship 3.1.1, which is affected.

Is there a fixed release I can install?

No. The newest tag is 3.1.1 from 2022, and the fix exists only on the development branch. Build from commit 854fbbe01bbf or ask your distribution to backport it.

Does the attacker need a password?

The attacker needs to name a community the supernode serves. An open community, or one whose password is known or empty, is enough. The packet itself has no user authentication step beyond the community's auth scheme.

Is this only a denial of service?

The CVE record describes both a crash and code execution through a canary and pointer leak. No public exploit demonstrates the code-execution path, so treat the crash as certain and the code execution as described but unproven.

References

  • CVE.org, CVE-2026-136404 record (checked November 25, 2026)
  • ntop, n2n fix commit 854fbbe01bbf131bf4cb88f8450d7084267668e1, "wire: bound decoded auth.token_size and num_sn to destination sizes", 2026-06-22 (checked November 25, 2026)
  • ntop, n2n pull request 1243 (checked November 25, 2026)
  • ntop, n2n wire.c at tag 3.1.1 (checked November 25, 2026)
  • ntop, n2n n2n_typedefs.h at tag 3.1.1 (checked November 25, 2026)
  • ntop, n2n releases page, newest tag 3.1.1, 2022-03-31 (checked November 25, 2026)
  • Debian, package search for n2n, versions in stable and testing (checked November 25, 2026)
  • GitHub Advisory Database, GHSA-6m96-96jm-r9r3 for CVE-2026-136404 (checked November 25, 2026)
  • CISA, Known Exploited Vulnerabilities catalog JSON feed, catalogVersion 2026.11.24 (checked November 25, 2026)

Free scan

Scan your own app for free

or book a demo

Keep reading

Related articles

Browse the blog