Linux In-Kernel NFS Server Heap Overflow "nfs2root" (CVE-2026-99362): Zero-Byte Slot Allocation, Compound SEQUENCE Overflow, and Root Slab Execution
A technical teardown of nfs2root (CVE-2026-99362): how negotiating a zero-byte reply cache slot and truncating NFSv4.1 SEQUENCE responses triggers an out-of-bounds heap write in nfsd4_store_cache_entry(), enabling remote root compromise over port 2049.
CVE-2026-99362 ("nfs2root") (CWE-122 Heap-Based Buffer Overflow / CWE-787 Out-of-bounds Write)
Severity: CRITICAL (UNAUTHENTICATED REMOTE ROOT KERNEL HEAP WRITE OVER TCP PORT 2049) (CVSS 9.8 Critical (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H))
Threat Actor: Chuck Lever & Jeff Layton (Patch Commit 35ff1a7a7e38); Public Exploitation Under Active Research
Status: Upstream Kernel Patch Merged; Backported to All Active LTS & Stable Branches
Affected Systems: Linux kernel 3.16 through 6.12.x / 6.18.x / 7.3.x (nfsd with NFSv4.1 or NFSv4.2 enabled)
Fixed In: Linux 5.10.275, 5.15.226, 6.1.193, 6.6.163, 6.12.118, 6.18.64, 7.3.5+
A critical remote memory-corruption vulnerability—dubbed "nfs2root" and tracked under CVE-2026-99362—has been identified in the Linux kernel’s in-tree Network File System server daemon (nfsd). With a maximum CVSS v3.1 score of 9.8, the vulnerability allows unauthenticated network attackers with network reachability to TCP port 2049 to trigger an out-of-bounds heap write directly in kernel slab memory. The defect stems from an architectural oversight in NFSv4.1 session negotiation: when an attacker negotiates a cached response size down to the exact baseline header threshold (NFSD_MIN_HDR_SEQ_SZ = 80 bytes), nfsd4_alloc_slot() computes a zero-byte reply cache buffer. By subsequently transmitting a crafted COMPOUND request containing a truncated SEQUENCE operation where the response buffer lacks space for the status code, the XDR encoder terminates early without setting an error status, leaving op->status = NFS_OK. When nfsd4_store_cache_entry() copies the response into the zero-byte buffer via read_bytes_from_xdr_buf(), up to 80 bytes overflow into adjacent kernel slab chunks, opening a direct path to kernel privilege escalation and unauthenticated remote code execution as root.

Root Cause Analysis: Memory Management Oversight in nfsd
The flaw is located in the kernel source file fs/nfsd/nfs4state.c inside nfsd4_alloc_slot(), and its downstream copy routine in fs/nfsd/nfs4proc.c.
1. Zero-Byte Allocation via Slot Negotiation
During the NFSv4.1 CREATE_SESSION exchange, the client and server negotiate slot parameters, including ca_maxresponsesize_cached. The server calculates the buffer required to store cached reply data for each session slot:
slot_size = maxresponsesize_cached - NFSD_MIN_HDR_SEQ_SZ;
slot->sl_cache_entry = kmalloc(slot_size, GFP_KERNEL);If an adversarial client specifies ca_maxresponsesize_cached == 80 (which exactly equals NFSD_MIN_HDR_SEQ_SZ), slot_size evaluates to 0. The Linux slab allocator (SLUB) returns a valid non-NULL pointer to a 0-byte chunk.
2. The COMPOUND SEQUENCE Status Encoding Trap
The client then sends a COMPOUND RPC request containing a SEQUENCE operation. When processing SEQUENCE, nfsd4_sequence() determines whether the reply fits in the client-specified response buffer:
if (xdr->buf->buflen < NFSD_MIN_HDR_SEQ_SZ) {
/* Prematurely narrow the encoding context */
xdr_truncate_encode(xdr, 0);
return nfserr_rep_too_big_to_cache;
}However, when the buffer is exactly 80 bytes, xdr_truncate_encode() leaves just enough room for the RPC reply header, but when encoding the individual operation status, the XDR encoder runs out of space. In this specific truncated condition, the error handling logic neglects to set the return code in the slot cache record, leaving op->status at its default initialized state: NFS_OK.
3. The Slab Heap Overflow
Because the operation status is marked as successful, the kernel attempts to save the cached response:
void nfsd4_store_cache_entry(struct nfsd4_compoundres *resp) {
struct nfsd4_slot *slot = resp->cstate.slot;
read_bytes_from_xdr_buf(resp->xdr.buf, 0, slot->sl_cache_entry, NFSD_MIN_HDR_SEQ_SZ);
}read_bytes_from_xdr_buf() unconditionally writes NFSD_MIN_HDR_SEQ_SZ (80 bytes) from the XDR buffer into slot->sl_cache_entry. Because slot->sl_cache_entry was allocated with a size of zero bytes, the copy operations writes 80 bytes directly over the adjacent kernel heap slab metadata and neighboring allocated kernel objects (such as credentials structures struct cred, IPC namespaces, or network packet sk_buff headers).
Detection Telemetry & Threat Hunting
Kernel Panic and Dmesg Signatures
Exploit attempts frequently trigger kernel slab corruption warnings prior to successful memory alignment. Defenders should query system logs for SLUB allocator anomalies:
dmesg -T | grep -E "(slab corruption|general protection fault|kernel NULL pointer dereference|nfsd:)"Look specifically for memory poison pattern alerts in kmalloc-64 or kmalloc-128 slab caches.
Network Telemetry (Suricata Rule)
alert tcp any any -> $NFS_SERVERS 2049 (
msg:"COLIBRISEC Linux Kernel nfsd Potential nfs2root CREATE_SESSION Abuse (CVE-2026-99362)";
flow:to_server,established;
content:"|00 00 00 28|"; depth:4; # RPC Compound Marker
content:"|00 00 00 2b|"; distance:8; within:4; # OP_CREATE_SESSION
content:"|00 00 00 50|"; distance:12; within:4; # 80 bytes (0x50) max cached response size
classtype:attempted-admin;
sid:20269936; rev:1;
)Patch Analysis & Upstream Remediation
The vulnerability was resolved upstream by enforcing a strict lower-bound floor on slot_size in fs/nfsd/nfs4state.c (Commit 35ff1a7a7e38):
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1728,6 +1728,11 @@ static struct nfsd4_slot *nfsd4_alloc_slot(struct nfsd4_channel_attrs *attrs)
slot_size = attrs->maxresp_cached - NFSD_MIN_HDR_SEQ_SZ;
+ if (slot_size <= 0) {
+ attrs->maxresp_cached = NFSD_MIN_HDR_SEQ_SZ + 8;
+ slot_size = 8;
+ }
slot = kzalloc(struct_size(slot, sl_cache_entry, slot_size), GFP_KERNEL);Recommended Remediation Steps:
- Deploy Kernel Updates: Upgrade host kernels to patched stable releases: Linux 5.10.275, 5.15.226, 6.1.193, 6.6.163, 6.12.118, 6.18.64, or 7.3.5+.
- Perimeter Network Filtering: Restrict TCP port 2049 access at border and host firewalls. Inbound NFS traffic must be allowed solely from trusted, authorized client IP addresses.
Protocol Workaround: If kernels cannot be immediately rebooted, disable NFSv4.1 and NFSv4.2 protocol versions in /etc/nfs.conf:
[nfsd]
vers4.1=n
vers4.2=nThen reload the daemon: systemctl restart nfs-server.