NFS2ROOT (CVE-2026-99362): Auditing an nfsd Slot Overflow No Version Scanner Could Find
One TCP connection to a Linux NFS server's port 2049 can hand an unauthenticated remote caller a root shell. No credentials, no valid export, no mounted file system — three RPC operations that require none of those. That is CVE-2026-99362, nicknamed NFS2ROOT, and it is the rare kernel advisory that reads like a science-fiction checklist: pre-auth, remote, heap overflow, twelve years old, and fixed in exactly one file.
When the Linux kernel CNA published it on 19 November 2026, our fleet of a dozen-odd heterogeneous hosts needed an answer fast — which hosts serve NFSv4.1 or 4.2 from the kernel, and are those kernels above the fix? The twist that made a boring version-scan impossible is the same twist that makes this CVE worth studying: the attack runs before any export check, so the hosts that matter are not the ones you exported to — they are the ones listening at all.
What the bug actually is
CVE-2026-99362 is a heap overflow in nfsd, the NFS server compiled into the Linux kernel. It lives in the NFSv4.1/4.2 session machinery, in fs/nfsd/nfs4state.c, and the upstream fix text ("nfsd: preflight SEQUENCE replies before accepting a slot") describes the exact sequence:
- NFSv4.1 sessions give each slot a reply cache, so a retried request is answered exactly once. The client decides how large that cache is, via
ca_maxresponsesize_cachedwhen it creates the session. - A malicious client negotiates that limit down to the minimum header size.
nfsd4_alloc_slot()then gives every slot a zero-lengthsl_data[]buffer. nfsd4_sequence()narrows the reply buffer to that cached-reply limit before accepting the slot seqid. A crafted COMPOUND tag fills the narrowed buffer exactly so it holds theSEQUENCEopcode but not the status word that follows.nfsd4_encode_operation()returns without runningnfsd4_encode_sequence(), leavingop->statusatnfs_ok— the COMPOUND is treated as having succeeded.nfsd4_store_cache_entry()then copies the whole reply — RPC and COMPOUND headers, tag and all — into the zero-length slot buffer.
The result is the write you never want to see in a public advisory:
BUG: KASAN: slab-out-of-bounds in read_bytes_from_xdr_buf
Write of size 80 at addr ffff888003a549cd
__asan_memcpy
read_bytes_from_xdr_buf
nfsd4_sequence_done
nfs4svc_encode_compoundres
Eighty bytes copied, of which roughly 61 land past the end of the kernel heap object — and 40 of those bytes are chosen by the client, which is why the overflow converts to code execution rather than just a crash. The kernel CVE record rates it CVSS v3.1 9.8 Critical (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).
The full attack is three operations, all legal without a filehandle: EXCHANGE_ID, CREATE_SESSION and SEQUENCE. None of them call fh_verify or check export access — so a Kerberos-only export policy does not close the path, because these operations run before any export-aware check. NFSv3 and NFSv4.0 do not implement the session machinery and are not affected; only 4.1 and 4.2 are.
Where it came from, and where the fixes are
The vulnerable code was introduced in Linux 3.16, released August 2014. Twelve years later the CVE team assigned the full stable-branch matrix in one batch:
| Branch | Introduced | Fixed in |
|---|---|---|
| 5.10 LTS | 3.16 | 5.10.275 |
| 5.15 LTS | 3.16 | 5.15.226 |
| 6.1 LTS | 3.16 | 6.1.193 |
| 6.6 LTS | 3.16 | 6.6.163 |
| 6.12 LTS | 3.16 | 6.12.117 |
| 6.18 | 3.16 | 6.18.61 |
| 7.3 | 3.16 | 7.3.2 |
| mainline | 3.16 | 7.4-rc1 |
Distributions are the layer where version arithmetic stops working. On 25 November 2026 the state was ragged, which is precisely the point:
| Distribution | Status |
|---|---|
| Debian 13 (trixie) | Fixed in 6.12.117-1 |
| Debian 12 (bookworm) | Default linux kernel 6.1.192-2 still vulnerable; the linux-6.12 backport is fixed in 6.12.117-1~deb12u1 (DLA-4927-1) |
| Ubuntu 22.04 / 24.04 | No fixed kernel at the time of writing |
| Ubuntu 26.04 | Fix pending; the 7.0.0-44 kernel installed by unattended-upgrades does not have it |
| RHEL 6–10 | Affected, no fixed kernel yet (rated Critical) |
Two classes of mistake hide in that table. First, backports make "old" versions safe: a bookworm host on 6.1.192-2 is vulnerable while another on the same branch but with the LTS update is patched — the running kernel version number cannot distinguish them. Second, vendor kernels make "new" versions unsafe: the appliance kernel we found was built weeks after the fix shipped, yet sat below every fixed branch, because a storage-vendor build is not an upstream tag. The only reliable signal is the vendor's own changelog naming CVE-2026-99362 or the fix commit (35ff1a7a7e38 upstream, 1a5a227bca6a on 6.12).
The audit: check what listens, not what you exported
The exposed surface is defined by nfsd itself, not by the export table. An NFS server that exports nothing is still exploitable if its kernel nfsd thread pool is running, because the three attack operations need no filehandle. So the scan asked five questions per host, in dependency order:
#!/bin/bash
# How many hosts actually expose NFS? Then: are they below the fix?
echo "=== $(hostname) ==="
echo "kernel: $(uname -r)" # compare to fixed branches
[ -d /proc/fs/nfsd ] && echo "nfsd: present"
echo "threads: $(cat /proc/fs/nfsd/threads 2>/dev/null || echo 0)"
echo "versions: $(cat /proc/fs/nfsd/versions 2>/dev/null)" # +4.1 +4.2 -> in scope
ss -ltnH 2>/dev/null | grep -w 2049 && echo "listening: TCP 2049" || echo "listening: NONE"
cat /etc/exports 2>/dev/null | grep -v '^#' | head -3
A single ansible all -m script -a /tmp/nfs-audit.sh -f 8 -o covered the fleet in under a minute. The verdict: nearly every host reported listening: NONE and no nfsd — workstations, application servers, gateways, all clean. Exactly one machine had +4.1 +4.2 in /proc/fs/nfsd/versions, a live nfsd thread pool, and TCP 2049 open — a network-attached-storage appliance exporting a volume to a small three-node Kubernetes cluster on a private subnet.
That one hit had a second surprise hiding behind it. The appliance's kernel was the vendor's own build, version 6.12.113-derived — below the 6.12.117 fix even though it was compiled weeks later (the second class of mistake above). And because this vendor builds nfsd into the kernel image rather than as a module, a lsmod | grep nfsd check would have reported nothing at all. Only the /proc/fs/nfsd checks and a look at the configured protocol versions revealed the surface.
The third surprise was IPv6. nfsd in the kernel binds both address families, and the box was listening on [::]:2049 as well as IPv4 — but the firewalling story for IPv6 was policy ACCEPT with zero rules. Restricting the IPv4 side would have been a half-fix; the IPv6 side was identical surface with no rules at all.
The fix: shrink the allowlist to the hosts that actually connect
The storage appliance exports to the k3s cluster, and the export was declared for the entire cluster subnet (…(sec=sys,rw,all_squash,…)). But "exported to the subnet" is not "needed by the subnet" — the only hosts that ever connect over NFS/RPC are the three k3s nodes themselves. The firewall rule was therefore tightened from the subnet to exactly those three node addresses, and hardened around the edges:
- Fixed RPC ports —
111(portmapper),2049(nfsd),20048(mountd) — allowed only from the three node IPs, both TCP and UDP. - Dynamic RPC ports —
nfsdregistersnlockmgrandstatuson ephemeral ports viarpcinfo, so the firewall script re-discovers them at apply time (rpcinfo -p→ 100021/100024) and restricts those to the same three IPs. Hard-coding the ports would break silently on the next service restart. - Default-deny made explicit —
iptables -P INPUT DROPis now stated in the managed script instead of inherited. - IPv6 closed —
ip6tables -P INPUT DROPwith only loopback, established/related and ICMPv6 allowed, closing the wide-open[::]:2049. - Idempotent and self-healing — the script purges any legacy subnet-wide NFS/RPC ACCEPT rules on every run, so a manual re-run (or a stale boot-time copy pointing at the old logic) cannot silently re-widen the exposure. Boot persistence is handled by the appliance's post-init hook, which now applies the same managed script.
Verification after apply:
$ iptables -L INPUT -n | grep 2049 # three "NFS node" allow rules, no subnet anywhere
$ ip6tables -L INPUT -n | head -3 # policy DROP, lo/established/icmpv6 only
# from an allowed k3s node:
$ mount | grep k3s # still mounted, export intact
$ rpcinfo -p <nas> # mountd + nfsd answer normally
# from a host outside the allowlist:
$ nc -vz <nas> 2049 # timed out, dropped
The cluster kept working; the negative test proved the closure. Existing connections were unaffected because established/related traffic stays permitted, and the three legitimate clients retained every port they actually use.
What a version scan would have missed
The uncomfortable part of this episode is that no amount of kernel-version comparison would have produced the right answer. The three failures, in order:
- The appliance looked "recent" but was old. A vendor kernel compiled in November sat below the 6.12.117 fix —
uname -rlies when the branch matrix is the source of truth. - The module check looked "clean" but was wrong.
lsmodshows nothing for an in-kernelnfsd; only/proc/fs/nfsdand the listening socket answer the real question. - The firewall looked "secure" but was half-open. The IPv4 side had a subnet allowlist; the IPv6 side, listening on the same port, had policy ACCEPT and no rules. No scanner that reads only IPv4 filter tables would have flagged it.
The one signal that carried all three lessons is who actually connects. An export for a subnet is a policy wish; the connection table is the ground truth. When the next kernel advisory lands — and it will, this bug family is a genre — the fast path is: enumerate listeners, not exports; treat IPv4 and IPv6 as two separate copies of every surface; and shrink firewall allowlists to the hosts that demonstrably use the service.
The mitigation on our appliance is now durable and restart-proof. The true fix is still a vendor kernel above 6.12.117, which means scheduling a maintenance window around the live consumers of that NFS volume — because on this appliance, as with most of them, the storage downtime is the real cost. The firewall bought the time; the actual upgrade remains on the calendar.