NFS (target-machine)
Refer to the following notes for more information on NFS:
From the target machine (remote shell)
The NFS (Network File Sharing) configuration is found in the /etc/exportsfile. The important element for privilege escalation is present with the no_root_squash value. With this value, we are able to create a SUID executable binary on the target machine via the NFS connection, and execute it to gain a root shell.
We can use the showmount command to show the mountable shares on the target machine (from our attacker machine)
To be ran as root on the attacker machine (mount the file system for the target machine)
Create temporary directory
Mount the shares on the target machine (the mount point should be one with the
no_root_squashoption set)Create a C program to gain root shell
Compile the C code to binary
Set the SUID bit on the output binary
On the target machine
Navigate to the directory where the
SUIDbit binary is presentRun the binary to gain a root shell
Last updated