Table of Contents


Summery

Network File System (NFS) is a network file system developed by Sun Microsystems and has the same purpose as SMB. Its purpose is to access file systems over a network as if they were local. However, it uses an entirely different protocol. NFS is used between Linux and Unix systems. This means that NFS clients cannot communicate directly with SMB servers. NFS is an Internet standard that governs the procedures in a distributed file system. While NFS protocol version 3.0 (NFSv3), which has been in use for many years, authenticates the client computer, this changes with NFSv4. Here, as with the Windows SMB protocol, the user must authenticate.

VersionFeatures
NFSv2It is older but is supported by many systems and was initially operated entirely over UDP.
NFSv3It has more features, including variable file size and better error reporting, but is not fully compatible with NFSv2 clients.
NFSv4It includes Kerberos, works through firewalls and on the Internet, no longer requires portmappers, supports ACLs, applies state-based operations, and provides performance improvements and high security. It is also the first version to have a stateful protocol.

When footprinting NFS, the TCP ports 111 and 2049 are essential. We can also get information about the NFS service and the host via RPC

Additional notes

  1. I was also able to mount an NFS share with this command: sudo mount -t nfs 10.129.211.11: /home/htb-ac-313174/nfs6. It was a NFSv4 and it had inmapping enabled but this allowed me to pass it.
  2. It is important to note that if the root_squash option is set, we cannot edit files on the share, even as root.
  3. We can also use NFS for further escalation. For example, if we have access to the system via SSH and want to read files from another folder that a specific user can read, we would need to upload a shell to the NFS share that has the SUID of that user and then run the shell via the SSH user.

Commands

showmount -e 10.129.14.128 - Show available shares
sudo mount -t nfs 10.129.14.128:/ ./target-NFS/ -o nolock - Mount a share
sudo umount ./target-NFS - Unmount a share