NFS (attacker-machine)
NOTE: Do not confuse this method with NFS (client-side). The NFS server in this case is ran from the attacker machine instead
Attacker machine
Create a mountable share point hosting a shellcode with root as owner, and SUID bit set
Make the shellcode file executable by all
Target machine
Mount the attacker share
Execute the binary to gain a root shell
Required conditions
NFS share configurations does not suppress SUID
Attacker machine
/etc/exportsshould have theno_root_squashoption for the export:
/... *(...,no_root_squash)Target machine
The mount option should have the
-o suidflag set:
Misconfigured mount settings
Note that the
mountcommand requires superuser privileges
Writable
/etc/fstab— this file controls the mounting of file systems on bootWritable and privileged cron-jobs, or systemd services with mount functions that allows an attacker to modify the contents, and point the mount towards the attacker server instead
Method to run
mountwithout sudo
Enumeration (possible scripts)
Last updated