NFS no_root_squash Detection
By default, NFS maps root (UID 0) from clients to the anonymous user nfsnobody on the server — this is root squashing. When no_root_squash is set on an export, root on any permitted client retains root privileges on the mounted share. Writing a SUID binary or injecting an SSH key from a client with local root gives full access to the server account that owns the share.
Read Export Options via showmount
showmount -e lists exports but does not show options. Options are visible in the server's /etc/exports if you have read access, or via the NFS mount response:
Export list for 10.10.10.50: /home/backup * /data 10.10.10.0/24
showmount shows paths and client access lists but not mount options. Use nmap to retrieve options:
| nfs-showmount: | /home/backup (everyone) |_ /data (10.10.10.0/24)
Check Export Options with nmap
The nfs-ls script retrieves export options including squash settings:
| nfs-ls: Volume /home/backup | access: Read Lookup NoModify NoExtend NoDelete NoExecute | nfs-ls: Volume /data | access: Read Lookup Modify Extend Delete Execute | NFS: (rw,no_root_squash,no_subtree_check)
no_root_squash in the options field is a confirmed misconfiguration. rw combined with no_root_squash is exploitable — write a SUID binary or inject SSH keys as a client with local root.
Mount and Check Effective Permissions
Mount the export and verify effective UID mapping:
Check how root maps on the server side:
If files are owned by root and writable, root squashing is off. Create a test file as root on the client:
-rw-r--r-- 1 root root 0 May 15 14:22 root_test
File owned by root (not nfsnobody or 65534) confirms no_root_squash. Clean up:
Read /etc/exports Directly
If the share exposes the filesystem root or /etc:
/data *(rw,no_root_squash,no_subtree_check) /home/backup *(ro,root_squash)
Direct read of /etc/exports shows all exports and their options in one step. Also check /etc/exports.d/ for split config files.
Impact Classification
Export options | Impact |
|---|---|
| Full root write — SUID shell, SSH key injection, direct file overwrite |
| Root read — access to all files regardless of permissions, readable shadow/passwd |
| UID spoofing only — see NFS UID Spoofing |
| Read access limited to world-readable files |
no_root_squash on a read-write export is the highest-severity NFS misconfiguration. For the full exploitation workflow see NFS no_root_squash Abuse.
References
-
Linux man — exports(5)linux.die.net/man/5/exports (opens in new tab)
NFS export options including root_squash, no_root_squash, all_squash
-
nfs-ls NSE scriptnmap.org/nsedoc/scripts/nfs-ls.html (opens in new tab)
Export listing with mount options and access flags
Was this helpful?
Your feedback helps improve this page.