Information Gathering
Rustscan
Rustscan finds FTP, SSH, and HTTP open:
Nmap
Nmap finds nothing much:
Enumeration
FTP - TCP 21
It seems like anonymous login is not allowed, I would have to come back to FTP with valid credentials:
HTTP - TCP 80
The website shows a security dashboard for user Nathan:
Going to /capture
will read me to http://10.10.10.245/data/1
, where I can download packets pcap file:
After downloading, I can see all the packets that is being sent from my IP to the target server:
http://10.10.10.245/netstat
shows network running on server:
http://10.10.10.245/ip
shows the result of ifconfig command:
Directory Bruteforcing finds nothing intriguing:
sudo feroxbuster -u http://10.10.10.245 -n -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt -C 404
Shell as Nathan
Bruteforce on /download
I tried Command Injection on /netstat
and /ip
parameters but both weren’t vulnerable. So I will move on to bruteforcing /data/<number>
since there might be a download from other users as well.
Using bash script, I can automate this procedure, which will download files from /download/0
to /download/100
:
Running the bash script discovered one more download which is /download/0`:
Before analyzing the file 0 with Wireshark, I will hunt for keyword pas and it discovers: Buck3tH4TF0RM3!
strings 0 | grep -i 'pass'
Opening file 0 using Wireshark shows that found password is from user Nathan during he’s FTP authentication:
We can see it in plain text by following the TCP Stream:
FTP nathan
Using the found credentials, I can sign-in to FTP as nathan:
Below is how /var/www/html
is consisted for this server and we can view all the .pcap files on /var/www/html/upload
:
Since FTP shell is restrictive to commands, I tried to upload reverse shell to /var/www/html
but permission was denied for all the folder.
Luckily, nathan is reusing the same password for his SSH connection as well so I can obtain a stable shell through SSH.
Privesc: nathan to root
Running linpeas.sh discovers capabilites on python3.8:
cap_setuid has the following ability according to the man page:
- Make arbitrary manipulations of process UIDs (setuid(2), setreuid(2), setresuid(2), setfsuid(2)); * forge UID when passing socket credentials via UNIX domain sockets; * write a user ID mapping in a user namespace (see user_namespaces(7)).
I can abuse this capability following guide from GTFOBins:
Running the command from above, It instantly give me shell as the root:
/usr/bin/python3.8 -c 'import os; os.setuid(0); os.system("/bin/sh")'