NFS World-Readable Share – File and Credential Extraction
NFS shares exported with no access restrictions — *(rw), *(ro), or no client filter — can be mounted by anyone on the network without authentication. Mounting the share and reading its contents is direct exploitation. The value depends on what is on the share: SSH keys, configuration files, credentials, database dumps, scripts, and backup files are all common findings that lead to further access.
Mounting the Share
Install NFS client tools if not present:
Create a mount point and mount the share:
-o nolock disables NFS file locking, which avoids connection issues on older servers. Browse the share:
For NFSv3 explicitly:
For NFSv4:
Recursive File Listing and Search
Get a full picture of everything accessible before downloading:
Search immediately for high-value files:
Search for files containing password strings:
SSH Key Extraction
SSH private keys on an NFS share give direct access to any host where the corresponding public key is authorised. Look for them explicitly:
Copy any key found, fix permissions, and use immediately:
Also check .ssh/authorized_keys to understand which hosts trust the key.
Home Directory Access
If a user's home directory is exported, the entire contents are accessible. Check for:
.bash_history frequently contains commands with credentials typed inline — SSH passwords, database connections, API keys passed as arguments.
/etc Export – Credential Files
If /etc or a backup of it is exported:
Copy /etc/shadow for offline cracking:
Bulk Copy for Offline Analysis
When the share is large or connection is unstable, copy everything locally for offline analysis:
Then unmount cleanly:
Accessing Restricted Files via UID Matching
If you can see files on the share but cannot read them due to Unix permissions, see https://hackindex.io/services/nfs/exploitation/uid-spoofing — NFS trusts UIDs from the client and you can create a local user with a matching UID to gain read access without root.
To confirm open exports before extracting files, see NFS World-Readable Exports.
References
-
nfs(5) man pagelinux.die.net/man/5/nfs (opens in new tab)
Mount option reference including nolock, vers, and security mode options.
Was this helpful?
Your feedback helps improve this page.