An unofficial, read-only Hacker News reader.

Nfs2root: A 12-year-old pre-auth remote root in the Linux kernel's NFS server (opens external site)

216 points by dm 4 days ago | opensec.in | 95 comments on HN

View full thread · View on Hacker News

Comment thread (29)

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

    Replies (6)
    1. Well... I've seen enough examples in the past years of how trivial it is to get into bigger enterprise networks.Often solely with social engineering. NFS is in use at various places internally in my experience. So this can end up worse than anticipated if taken too lightly imo. Defense in depth...
      Replies (1)
      1. I’m not saying ignore this, but it’s not a run around hair on fire situation like php2shell. Just update your servers as normal.
    2. NFS in particular is an old protocol and authentication was bolted on later in its long history. It's pretty common to configure it in a way that you trust the client when they say they're root. This adds to the perception that nobody would assume it's safe to expose.
      Replies (2)
      1. NFSv3 assumes that uid/gid synchronization is in place, and maps root activity on the shared volume to some kind of nobody (unless the volume is exported nosquash). The username is irrelevant; the uid controls access (AFAIK).

        NFSv4 needs idmapd, which is a different beast altogether.

        Replies (2)
        1. also you can nail on kerberos to actually enforce permissions if you're still just doing uid/guid matching.

          Still, getting root on your internal fileserver isn't great.

        2. NFSv4 can also run in the sec=sys mode, without idmapd, where it blindly trusts the client-supplied UID, exactly as NFSv3 does.
          Replies (1)
          1. I did not know that. Thanks!
      2. > It's pretty common to configure it in a way that you trust the client when they say they're root

        This is how you can tell you’re reading a post from a Real Old Time hacker. Hasn’t been that way for a long time.

        Replies (2)
        1. I will take that as a compliment.
        2. The root_squash option has been default since as long as I can remember.
    3. Isn't this CVE-2026-99362? Because pretty much all of ubuntu installs are affected.
      Replies (2)
      1. I assume you mean "all Ubuntu installs of NFS" here. Your statement could be misread by those who don't know as "all Ubuntu installs", but NFS is not installed or turned on by default. I would expect very few installs do overall (but of course all of them will in specific environments).
        Replies (1)
        1. Yes, should have been more precise.
      2. Most ubuntu installs aren't running NFS servers.

        If someone sets up an NFS server, they know what kind of risk they open themselves up to.

        Replies (2)
        1. > If someone sets up an NFS server, they know what kind of risk they open themselves up to.

          I don't think preauth RCE is an expected risk of setting up NFS, actually.

          Replies (2)
          1. It's really not the most shocking thing in the world. I've never heard of anyone exposing the NFS port to the public internet intentionally, because people who run NFS servers know this is not expected to be secure.
            Replies (3)
            1. Not public internet, no, but open to internal networks. For example: University networks. Many installation with NFS shared home. Can people now get root on the server? I'm not sure you need mounting rights on the server (i.e. a /etc/exports entry) to exploit this.

              Continue this thread (1 replies) →

            2. Uh, I think part of the motivation for NFSv4 was the poor performance of NFSv3 over long distances (long fat pipes) across the Internet. But that was 20 years ago, before cloud computing / cloud storage became a thing.

              Continue this thread (1 replies) →

            3. I do recall an educational institute in the late 90s exporting their /home directories to *(rw,root_squash), No firewall.
          2. That's exactly the sort of risk I anticipated when I made the decision to only let my NFS server bind to my wireguard interface, years ago.
        2. The last time that I tried, you had to install the server package to get the client to work on Ubuntu.

          Then, you need to add volumes to /etc/exports with allowed hostnames (with lots of parameters for access control).

          I'm assuming that anything disallowed by /etc/exports is not allowed, this exploit included.

          Replies (1)
          1. I'm not so sure, it says pre-auth. Does anyone know?
            Replies (1)
    4. More than C, low level code for trivial userland daemons/functions. I remember WAV decoding functions on Win32 back in the day... in the kernel.
    5. Too lazy to check but I would t be surprised if there’s plenty of open ports on the internet for this protocol.
    6. The first time C code was exposed to the Internet, Morris worm happened.

      How little have we learnt since then.