logoalt Hacker News

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

109 points • by dm • yesterday at 8:35 PM • 39 comments • view on HN

Comments

r3tr0 • today at 12:06 AM

yeet can actually patch this via its XDP L7 programmable firewall

https://github.com/yeet-src/pfw

Here is the specific rule. I just added and confirmed it. (can see the CI).

https://github.com/yeet-src/pfw-rules/blob/53f78fc5823354f4a...

just pull the repo w `pfw pull` then `pfw ls` and apply and you're all set.

superkuh • today at 3:37 AM

It really sounds like this is only NFS 4.1 and 4.2 and up(?). So my mitigation for right now (on distros that are out of support re: kernel) is simply to disable 4.1 and 4.2 protocol like the below (turn nfs-server off first),

    $ echo "-4.1 -4.2" | sudo tee /proc/fs/nfsd/versions
I am no security expert but for now this change, which is temporary and reverts on reboot, seems reasonable. Before I did this I checked if my clients used nfs 4.1 or 4.2 at all and only one computer on my network did and it has fine 3/4 support. The vast majority of my nfs traffic is v3.
gsich • yesterday at 10:14 PM

no poc posted

➕ show 1 reply
snvzz • yesterday at 11:22 PM

Each such vuln a reminder that seL4[0] exists, and that Linux's TCB isn't getting smaller anytime soon.

0. http://sel4.systems/

➕ show 1 reply
Gigachad • yesterday at 10:06 PM

Thankfully no one assumed NFS secure for the public internet anyway so this should be minimally impactful. Also looks like it was patched upstream months ago.

Still, just another example of why C code can’t be exposed to the internet.

➕ show 5 replies
scottchiefbaker • today at 1:20 AM

This bug was patched several months ago. If you've been patching for all the CVEs that have come out recently you're probably already protected. Per the end of the article here are the patched version of each Kernel branch:

6.12.117

6.18.61

7.3.2

7.4-rc1

This is CVE-2026-99362

xiaoliangliang • today at 3:18 AM

[dead]

rvz • yesterday at 8:55 PM

Just wow. How was this achieved? Let's see:

> Pre-auth heap overflow in the Linux NFS server (nfsd)

> 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.

Then it causes an out-of-bounds crash:

   >> 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
So yet another memory corruption issue that gives the attacker control of the execution and its possible to get root on the system and this is in the kernel itself so "hardening" does not remove the bug.

What a disaster.

➕ show 1 reply