NFS2ROOT: 12-Year-Old Linux NFS Flaw Gives Attackers Root

A 12-year-old Linux NFS flaw lets unauthenticated attackers gain root remotely. CVE-2026-99362 affects exposed NFS servers.
A critical flaw in the Linux kernel’s NFS server, tracked as CVE-2026-99362 (CVSS score of 9.8) and called NFS2ROOT, lets remote attackers gain root without a password, account or user click. The vulnerability dates to 2014.
According to OpenSec, exploitation requires a vulnerable kernel, a running in-kernel NFS server (nfsd), NFSv4.1 or 4.2 enabled (the default), and access to TCP port 2049.
File servers, storage devices, build systems and Kubernetes storage nodes often use this port. The server doesn’t need to be exposed to the internet. An attacker can exploit it from inside the network if they can reach the service.
Before authentication, an attacker can set the reply cache size to zero. NFSv4.1 lets clients set the size of the cache used to store replies. By setting it to zero and sending a carefully crafted request, an attacker can force the Linux kernel to copy an 80-byte reply into an empty buffer. This causes a heap overflow, writing 61 bytes beyond allocated memory, including 40 bytes controlled by the attacker. The fix checks the buffer size before copying the reply and rejects data that cannot fit.

“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.” reads the report published by OpenSEC.
By sending normal NFS requests in a specific order, attackers can corrupt memory, read 3.8 KB of data, bypass address randomization and place a command in memory that has been reused. When the connection closes, the kernel executes that command with root privileges. OpenSec demonstrated the attack and gained root access before shutting down the server.
The bug was introduced by commit 47ee52986472 in March 2014 and first appeared in Linux 3.16. It also remained in later Linux distribution and storage appliance kernels.
Jérémy Jean of France’s cybersecurity agency, ANSSI, found the vulnerability and submitted a fix on August 17, 2026. Commits 5d5a72e965c8 and 241848cc774e check that replies fit and report data the system can’t store.
OpenSec found it independently: its Antara system flagged it on September 21, scored it and built the attack without human help. The company sent maintainers and the Linux security team the exploit and a patch the next day. The CVE and fixes appeared November 20; Chuck Lever and Jeff Layton maintain the NFS server.
OpenSec is not aware of attacks in the wild exploiting this vulnerability.
Upgrade to Linux 6.12.117, 6.18.61, 7.3.2 or 7.4-rc1, as appropriate, and reboot. On distribution kernels, install the update listing CVE-2026-99362, since vendors can backport fixes without using those version numbers.
Check your exposure with these commands:
uname -r
lsmod | grep -w nfsd
cat /proc/fs/nfsd/versions
ss -ltn 'sport = :2049'
If you can’t install the security update immediately, you can reduce the risk by limiting access to TCP port 2049, which NFS uses. Allow connections only from trusted storage networks and block all other sources. The example below allows traffic from the 10.20.0.0/16 subnet and blocks other IPv4 addresses:
nft add rule inet filter input tcp dport 2049 ip saddr != 10.20.0.0/16 dropThis rule covers only IPv4 traffic, so you must also restrict IPv6 access separately.
Another option is to disable NFSv4.1 and NFSv4.2 by setting vers4.1=n and vers4.2=n under the [nfsd] section in /etc/nfs.conf, then restarting the nfs-server service. However, this disables pNFS and some NFSv4.2 features. If you don’t need NFS file sharing, you can stop and disable the service entirely.
Monitoring is also important. According to OpenSec, the attack uses legitimate NFS traffic, so traditional network detection tools may not recognize it. Look for nfsd4_check_resp_size warnings in system logs, which appear during every exploitation attempt, whether successful or not.
Also investigate unexpected crashes involving nfsd4_*, svc_* or call_usermodehelper* functions, shells started by kernel worker processes, and bursts of short NFSv4.1 sessions from the same IP address.
These measures can reduce exposure while you prepare to install the security update. They do not fix the underlying vulnerability.
“Kernel hardening does not remove the overflow. Patch every host.” concludes the report.
Follow me on Twitter: @securityaffairs and Facebook and Mastodon
Pierluigi Paganini
(SecurityAffairs – hacking, NFS2ROOT)

