For the complete documentation index, see llms.txt. This page is also available as Markdown.

Pentesting NFS

Overview

  • Network File System — used for file sharing between Linux/Unix systems

  • Ports: TCP/UDP 111 (rpcbind), TCP 2049 (nfs)

NFS Versions

Version
Features

NFSv2

Older, initially entirely over UDP

NFSv3

More features, variable file size, better error reporting, not fully compatible with NFSv2

NFSv4

Includes Kerberos, works through firewalls/internet, no rpcbind needed, supports ACLs, applies state-based operations, improved performance, high security. First to have stateful protocol.

Configuration

  • Config file: /etc/exports

cat /etc/exports

Default Export Options

Option
Description

rw

Read/write

ro

Read only

sync

Synchronous transfer

async

Asynchronous transfer

secure

Ports below 1024 only

insecure

Ports above 1024

no_subtree_check

Disable subtree checking

root_squash

Map root UID/GID to anonymous

Dangerous Settings

Option
Description

rw

Read/write

insecure

High ports allowed

nohide

Export sub-mounted filesystems

no_root_squash

Files keep root UID/GID 0

Create NFS Export

Enumeration

Nmap

  • NSE scripts: nfs-ls, nfs-showmount, nfs-statfs, rpcinfo

Show Shares

Mounting

If the export name is shown by showmount, mount that path explicitly:

List with Usernames vs UIDs

Post-Mount Credential Hunting

NFS exports often expose app deployment directories and backup configs. Search broadly before moving on:

Unmount

Last updated