Skip to content
Misconfiguration Write-up Beginner

Privilege Escalation Via Insecure Nfs Mounts

An NFS export was configured with the no_root_squash option, so a client presenting root privileges was trusted as root on the share. An attacker with a low-privileged shell on the server could mount the export from their own machine, plant a root-owned SUID binary, and execute it on the target to gain root.

Aman Singh Gill Follow

Published on systemweakness.com

In this blog, I’ll walk through how I escalated my privileges from a low-privileged user to root on a remote server by abusing an insecurely configured NFS export (norootsquash).

Aman Singh Gill, on systemweakness.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The NFS export was configured with the no_root_squash option, which causes the server to trust the client's UID instead of mapping root to an unprivileged user.

Impact

An attacker with a low-privileged shell could escalate to root on the server, gaining full control.

What the attacker needed

Low-privileged shell on target; NFS export with no_root_squash; attacker machine with root access; network access to NFS service

The fix

The export should be configured with root_squash (or all_squash), mounted with nosuid, restricted to specific hosts, and ideally use NFSv4 with Kerberos.

How it was found

  1. Obtain a low-privileged shell on the target.
  2. Enumerate NFS exports and find one shared with everyone.
  3. Read /etc/exports and confirm the no_root_squash option.
  4. Mount the export from a machine where you have root.
  5. Compile a SUID binary into the mounted share and set the SUID bit.
  6. Execute the binary from the low-privileged shell on the target to get a root shell.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

NFS is a way for computers to share folders over a network, like a network drive. Normally, if someone with administrator (root) rights on their own computer connects, the server treats them as a nobody user for safety. Here, a setting called no_root_squash turned that safety off, so the server believed the attacker was root. The attacker then put a special program on the shared folder that runs with root rights, and ran it on the server to take full control.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by Aman Singh Gill

View all

8 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.