首页 > AI前沿 > Nfs2root: A 12-year-old pre-auth remote root in the Linux kernel's NFS server

Nfs2root: A 12-year-old pre-auth remote root in the Linux kernel's NFS server

Hacker News 2026-11-26 04:35 32 阅读 查看原文
Port 2049 sits open on file servers, NAS appliances, build farms and Kubernetes storage nodes. Since 2014, the Linux kernel listening on it has let anyone who can reach it write into kernel memory before logging in. We pointed OpenSec's Antara at it. It came back with a root shell. Pre-auth heap overflow in the Linux NFS server (nfsd) Fixed in Linux 6.12.117, 6.18.61, 7.3.2 and 7.4-rc1. Update the kernel and reboot. What you need to know What: a pre-auth heap overflow in the kernel's NFS server, nfsd. Who: any Linux host serving NFSv4.1 or 4.2 (the default) on a reachable tcp/2049. Impact: one TCP connection writes 61 bytes past a kernel heap object; chained, that gives a root shell. Now: patch and reboot. Until then, firewall tcp/2049. Key facts Severity 9.8 Critical (AV:N/AC:L/PR:N/UI:N) Attack Remote, unauthenticated, tcp/2049 Impact Kernel heap overflow → remote root shell Bug age 12 years, since Linux 3.16 (2014) Affected In-kernel nfsd with NFSv4.1 or 4.2 Fixed in 6.12.117 · 6.18.61 · 7.3.2 · 7.4-rc1 One connection, no login# The NFS server runs inside the kernel and parses network input before it knows who you are. CVE-2026-99362 lives in that gap: a client can shrink its reply cache to zero bytes, then make the server copy a full reply into it. The copy lands on the kernel heap, and the client picks most of the bytes. Twelve years in a few lines of C# Timeline Mar 2014 Commit 47ee52986472 narrows the reply buffer while handling SEQUENCE. It ships in Linux 3.16. Commit 47ee52986472 narrows the reply buffer while handling SEQUENCE. It ships in Linux 3.16. 2014 to 2026 12 yearsEvery kernel since 3.16 carries it: LTS, distribution and appliance kernels. 12 yearsEvery kernel since 3.16 carries it: LTS, distribution and appliance kernels. 17 Aug 2026 Jérémy Jean of ANSSI sends a fix upstream with a KASAN report. Jérémy Jean of ANSSI sends a fix upstream with a KASAN report. 21 Sep 2026 OpenSec's Antara flags the bug, scores it 9.8 and turns it into a root shell on its own. OpenSec's Antara flags the bug, scores it 9.8 and turns it into a root shell on its own. 20 Nov 2026 CVE-2026-99362 is published with fixes. CVE-2026-99362 is published with fixes. Watch it run# A real run, end to end. Left: the victim's console. Right: our client on another machine, talking to the victim only over tcp/2049. Root cause# Each NFSv4.1 session slot caches its last reply, so a retried request is answered exactly once. The client decides how big that cache is. Set it to the minimum and every slot's buffer is zero bytes. nfsd4_sequence() then shrinks the reply buffer to that limit before it accepts the slot. Pad the request's tag so the buffer fills right after the SEQUENCE opcode, and the encoder quits without flagging an error. The server believes SEQUENCE succeeded and caches the whole reply, headers and tag included, into a buffer with room for nothing. BUG: KASAN: slab-out-of-bounds in read_bytes_from_xdr_buf+0x1bc/0x390 Write of size 80 at addr ffff888003a549cd __asan_memcpy+0x38/0x60 read_bytes_from_xdr_buf+0x1bc/0x390 nfsd4_sequence_done+0x5b0/0x810 nfs4svc_encode_compoundres+0x1bf/0x240 That is 80 bytes copied, 61 of them past the end of the heap object, 40 of them chosen by the client. The fix checks that the reply fits before taking the slot, and makes the encoder report what it can't fit. From overflow to root# The exploit stays private. Each step is an ordinary NFS request: Overflow The write corrupts the neighbouring slot's bookkeeping. The write corrupts the neighbouring slot's bookkeeping. Leak A replay request returns 3.8 KB of kernel heap, and with it the KASLR slide. A replay request returns 3.8 KB of kernel heap, and with it the KASLR slide. Free A forged pointer makes the kernel free an object we choose. A forged pointer makes the kernel free an object we choose. Reclaim We refill that memory with a fake callback built from NFS client names. We refill that memory with a fake callback built from NFS client names. Trigger We hang up. nfsd calls the fake callback, and the kernel runs /bin/sh as root. We hang up. nfsd calls the fake callback, and the kernel runs /bin/sh as root. In the recording, that command is whoami; id; poweroff -f: the victim prints root, then uid=0(root), and switches itself off. Found and proven by a machine# Antara, OpenSec's white-box harness, flagged the nfsd reply-cache path, scored it 9.8, and built the leak, the arbitrary free and the root shell shown in the video by itself: end to end, with no human in the loop. Kernel hardening does not remove the overflow. Patch every host. Kernel hardening does not remove the overflow. Patch every host. Am I exposed?# Tick what's true for your host. All four means exposed, today. Am I exposed? KernelOlder than 6.12.117, 6.18.61, 7.3.2 or 7.4-rc1, with no distribution backportuname -r nfsd runningThe in-kernel NFS server is loadedlsmod | grep -w nfsd NFSv4.1 or 4.2 onThe list shows +4.1 or +4.2cat /proc/fs/nfsd/versions 2049 reachableListening on an address other than loopbackss -ltn 'sport = :2049' What to do# Patch and reboot# On a distribution kernel, install the update that lists CVE-2026-99362. Can't patch today? Close 2049# nft add rule inet filter input tcp dport 2049 ip saddr != 10.20.0.0/16 drop Or turn off NFSv4.1 and 4.2# [nfsd] vers4.1=n vers4.2=n Then restart nfs-server. This turns off pNFS and some 4.2 features. Hunting for it# The attack is valid NFS, so there is no network signature. Look for: Kernel warnings from nfsd4_check_resp_size, on every attempt, successful or not. Oopses with nfsd4_*, svc_* or call_usermodehelper* frames. Shells spawned by kernel workers on a file server. Bursts of short NFSv4.1 sessions from one source. Disclosure# We reported the bug to the NFSD maintainers and security@kernel.org on 22 September 2026 with the full remote-root exploit, and sent a patch the same day. CVE-2026-99362 was published with fixes on 20 November. Credits# OpenSec Intelligence: found the bug with Antara, which escalated it to pre-auth root on its own, and reported it with the full exploit and a patch. Jérémy Jean (ANSSI): found it independently and wrote the upstream fix, 5d5a72e965c8 and 241848cc774e. Chuck Lever and Jeff Layton: the NFSD maintainers. References# Introduced by 47ee52986472 (Linux 3.16) Patch thread OpenSec's patch submission