Inspect RPC/NFS exports and effective file identity
Needs: Reachable RPC/NFS transports, permitted client address and an export whose UID/GID mapping grants relevant access
List RPC services and exports
# Baseline: list RPC services and exports
rpcinfo -p TARGET
showmount -e TARGET
# Variant — Nmap without mounting
nmap -sV -p 111,2049 --script nfs-showmount,nfs-ls,nfs-statfs TARGET
# Variant — mount read-only first
sudo mkdir -p /mnt/nfs-audit
sudo mount -t nfs -o ro,vers=3,nolock TARGET:/EXPORT /mnt/nfs-audit
find /mnt/nfs-audit -maxdepth 3 -ls
sudo umount /mnt/nfs-audit
# Variant — inspect numeric ownership
ls -lan /mnt/nfs-audit
find /mnt/nfs-audit -maxdepth 3 -type f -readable -ls
# Variant — bounded write verification
sudo mount -t nfs -o rw,vers=3,nolock TARGET:/EXPORT /mnt/nfs-audit
touch /mnt/nfs-audit/probe-file
ls -ln /mnt/nfs-audit/probe-file
rm /mnt/nfs-audit/probe-file
sudo umount /mnt/nfs-audit
# Rsync daemon — list modules before copying
nmap -sV -p 873 --script rsync-list-modules TARGET
rsync rsync://TARGET/
rsync --list-only rsync://TARGET/MODULE/
# Variant — retrieve a selected file or a reviewed module
# One selected artifact
rsync -av rsync://TARGET/MODULE/path/FILE ./FILE
# A reviewed module into a dedicated local evidence directory
mkdir -p ./rsync-MODULE
rsync -av --safe-links rsync://TARGET/MODULE/ ./rsync-MODULE/
Decisive output:
rpcinfomaps RPC programs to versions/transports/ports.showmount -ereturns exports and apparent allowed clients, but NFSv4-only servers may not expose the mount service andshowmountcompleteness varies by implementation.
NFS commonly authorizes Unix identities by numeric UID/GID. A matching local username is irrelevant if its number differs.
root_squashusually maps remote UID 0 to an unprivileged identity;no_root_squashis dangerous but still requires a useful writable object and privileged consumption path.
Use a unique harmless name only when write validation is needed and authorized. Record the resulting numeric owner/group. Success proves write in that directory, not execution or privileged ownership.
Decisive output: a named module and a file listing establish only that the current anonymous or supplied account can enumerate that namespace. Read access is proven by retrieving selected bytes, not by the module name.
Failure cues: no listed modules can mean the daemon hides its module list;
@ERROR: auth failedis an authentication boundary;@ERROR: Unknown moduleis a namespace error; a listed module can still deny individual reads or writes.Next action: inspect selected readable backups, keys, source and configuration locally. Treat a writable module as file placement only until a specific consumer, destination identity and trigger are proven. Do not use
--deleteagainst a remote module during enumeration.
TFTP — known-name retrieval only
Recognize: TFTP normally uses UDP/69 for the initial request and has no directory-listing or login model. It is useful only when configuration, source, boot metadata or another service gives a plausible filename.
# TFTP — known-name retrieval only
tftp TARGET
tftp> binary
tftp> get FILE
tftp> quit
Decisive output: a completed transfer plus recognizable local bytes establishes read access to that exact name. A timeout is ambiguous because the UDP request, server policy, transfer port or filename can fail without a useful error.
Bounded write check only when the objective requires it
# Variant — bounded write check only when the objective requires it
printf '%s\n' 'TFTP_WRITE_CANARY' > tftp-probe.txt
Bounded write check only when the objective requires it
# Variant — bounded write check only when the objective requires it
tftp TARGET
tftp> binary
tftp> put tftp-probe.txt
tftp> quit
Use a unique harmless filename and only when write capability changes the next decision. TFTP normally offers no remote delete operation; do not create a probe unless you already have an authorized cleanup route.
Next action: inspect a retrieved artifact and follow only evidence-backed filenames. A successful upload is not execution; prove the server-side path and consumer separately.
Verify → Verify the export, mapped identity, actual bytes and any created file's server-side ownership.
If it fails → An empty showmount response does not rule out NFSv4. Mount failure may be transport/export/client-policy rather than absence of files. More detail ↓
Explanation & examples
Inspect RPC/NFS exports and effective file identity
- USE WHEN
- RPC/NFS listeners or export information
- STARTING ACCESS
- A confirmed reachable application; anonymous context or one identified credential
- RESULT
- Readable files or a controlled write with established identity semantics
Recognize the clue
Follow RPC/NFS discovery with export inspection, then examine actual ownership/mapping on an allowed mount.
rpcinfo -p TARGET
showmount -e TARGET
100003 3 tcp NFS_PORT nfs
Export list for TARGET:
/EXPORT CLIENT_SCOPEMeans: An export lists a filesystem candidate and client policy; it does not establish file access or trusted UID 0.
Confirm: Use the owning procedure to verify NFS version, allowed client, numeric identity mapping, read/write and squash/mount policy.
- After validation
- The relevant mapped identity can read configuration: retrieve and classify its useful artifacts.
- Ruled out in this context
- The export permits a different client scope: rule out this source's mount route.
- Still inconclusive
- Empty showmount can miss NFSv4 context; confirm version/export behavior before declaring no NFS access.
Troubleshooting: An empty showmount response does not rule out NFSv4. Mount failure may be transport/export/client-policy rather than absence of files.
Recognize: rpcbind commonly appears on TCP/UDP 111 and NFS on TCP/UDP 2049, with additional dynamically assigned RPC ports. Goal: find exports, allowed client ranges and effective UID/GID-based permissions.
Baseline: list RPC services and exports
Decisive output:
rpcinfomaps RPC programs to versions/transports/ports.showmount -ereturns exports and apparent allowed clients, but NFSv4-only servers may not expose the mount service andshowmountcompleteness varies by implementation.
Variant — Nmap without mounting
The scripts can list exports, file attributes and access flags. Confirm access manually when a finding matters.
Variant — mount read-only first
If version 3 fails and version 4 is advertised, retry with -o ro,vers=4. NFSv4 may present a pseudo-filesystem whose export path differs from showmount output.
Variant — inspect numeric ownership
NFS commonly authorizes Unix identities by numeric UID/GID. A matching local username is irrelevant if its number differs. root_squash usually maps remote UID 0 to an unprivileged identity; no_root_squash is dangerous but still requires a useful writable object and privileged consumption path.
Variant — bounded write verification
Use a unique harmless name only when write validation is needed and authorized. Record the resulting numeric owner/group. Success proves write in that directory, not execution or privileged ownership.
Failure cues:
showmountfailure does not rule out NFSv4.access denied by servercan mean export client restrictions or wrong path/version.permission deniedafter mounting is file authorization, not network failure. Do not change local UIDs or write to an export during concept study.
Next action: inspect readable backups, home data, keys and configuration; record numeric ownership and actual write boundaries; send a writable/privileged-consumer hypothesis to the escalation block.
Rsync daemon — list modules before copying
Recognize: an rsync daemon normally listens on TCP/873, although the application can use another port. The daemon namespace uses
HOST::MODULEorrsync://HOST/MODULE; a single colon is SSH/remote-shell syntax and is a different access path.
Decisive output: a named module and a file listing establish only that the current anonymous or supplied account can enumerate that namespace. Read access is proven by retrieving selected bytes, not by the module name.
Variant — retrieve a selected file or a reviewed module
--safe-links ignores symbolic links that point outside the copied tree. Review module size and content first; do not mirror a large tree by default. If authentication is required, let rsync prompt or use a protected --password-file rather than putting a password on the command line.
Failure cues: no listed modules can mean the daemon hides its module list;
@ERROR: auth failedis an authentication boundary;@ERROR: Unknown moduleis a namespace error; a listed module can still deny individual reads or writes.Next action: inspect selected readable backups, keys, source and configuration locally. Treat a writable module as file placement only until a specific consumer, destination identity and trigger are proven. Do not use
--deleteagainst a remote module during enumeration.
TFTP — known-name retrieval only
Recognize: TFTP normally uses UDP/69 for the initial request and has no directory-listing or login model. It is useful only when configuration, source, boot metadata or another service gives a plausible filename.
Decisive output: a completed transfer plus recognizable local bytes establishes read access to that exact name. A timeout is ambiguous because the UDP request, server policy, transfer port or filename can fail without a useful error.
Variant — bounded write check only when the objective requires it
Use a unique harmless filename and only when write capability changes the next decision. TFTP normally offers no remote delete operation; do not create a probe unless you already have an authorized cleanup route.
Next action: inspect a retrieved artifact and follow only evidence-backed filenames. A successful upload is not execution; prove the server-side path and consumer separately.
Why it works
NFS authorization can depend on numeric IDs and export options. root_squash prevents remote UID 0 from automatically becoming server root; no_root_squash alone still needs a useful consumer or execution path.
Worked example · hypothetical
Observation: an export permits the assessment client. Test: inspect ownership and a scoped read. Illustrative output: a backup configuration is readable under a matching numeric UID. Interpretation: recover its secrets; assess writes separately.
New identity, privilege, host or route? Re-enumerate → All topic tasks →