Skip to main content

Overview

NFS (Network File System) shares configured with no_root_squash allow remote root users to create files as root on the share. If the share is mounted on the target, any SUID file created will execute as root.

Enumerate NFS Shares

From Target

From Attacker

Look For

no_root_squash = remote root keeps root privileges on share.

Exploit

Step 1 — Mount Share on Attacker (as root)

Step 2 — Create SUID Binary

Step 3 — Execute on Target


Alternative — Copy SUID bash

On target:

Alternative — Write SSH Key

The key was written under the mounted /home/user share, so log in as that user (not root — root’s keys live in /root/.ssh, which isn’t mounted here):

root_squash vs no_root_squash