First we want to run a initial rustscan to see what ports are open and what services are on those ports.
sudo rustscan -a 10.129.133.133
.----. .-. .-. .----..---. .----. .---. .--. .-. .-.| {} }| { } |{ {__ {_ _}{ {__ / ___} / {} \ | `| || .-. \| {_} |.-._} } | | .-._} }\ }//\ \| |\ |`-' `-'`-----'`----' `-' `----' `---' `-' `-'`-' `-'The Modern Day Port Scanner.________________________________________: https://discord.gg/GFrQsGy :: https://github.com/RustScan/RustScan :--------------------------------------Real hackers hack time ⌛[~] The config file is expected to be at "/root/.rustscan.toml"[!] File limit is lower than default batch size. Consider upping with --ulimit. May cause harm to sensitive servers[!] Your file limit is very small, which negatively impacts RustScan's speed. Use the Docker image, or up the Ulimit with '--ulimit 5000'. Open 10.129.133.133:22Open 10.129.133.133:80Open 10.129.133.133:1337[~] Starting Script(s)[>] Script to be run Some("nmap -vvv -p {{port}} {{ip}}")[~] Starting Nmap 7.92 ( https://nmap.org ) at 2022-04-23 22:49 EDTInitiating Ping Scan at 22:49Scanning 10.129.133.133 [4 ports]Completed Ping Scan at 22:49, 0.11s elapsed (1 total hosts)Initiating Parallel DNS resolution of 1 host. at 22:49Completed Parallel DNS resolution of 1 host. at 22:49, 0.00s elapsedDNS resolution of 1 IPs took 0.00s. Mode: Async [#: 5, OK: 0, NX: 1, DR: 0, SF: 0, TR: 1, CN: 0]Initiating SYN Stealth Scan at 22:49Scanning 10.129.133.133 [3 ports]Discovered open port 80/tcp on 10.129.133.133Discovered open port 1337/tcp on 10.129.133.133Discovered open port 22/tcp on 10.129.133.133Completed SYN Stealth Scan at 22:49,0.07s elapsed (3 total ports)Nmap scan report for10.129.133.133Host is up, received echo-reply ttl 63 (0.034s latency).Scanned at 2022-04-2322:49:03 EDT for 0sPORT STATE SERVICE REASON22/tcp open ssh syn-ack ttl 6380/tcp open http syn-ack ttl 631337/tcp open waste syn-ack ttl 63Read data files from:/usr/bin/../share/nmapNmap done:1 IP address (1 host up) scanned in 0.33 seconds Raw packets sent:7 (284B) | Rcvd:4 (160B)
We get back the following information:
Port 22: running ssh
Port 80: running a web server
Port 1337: running waste (This looks interesting)
Enumeration
Visiting the site we can see it is running wordpress
Also hovering over a link gives us the hostname to put in our hosts file
/etc/hosts
# HTB10.129.133.133 backdoor.htb
Since this is wordpress we can use wpscan to try and find a vulnerability
Going to that url in the poc we get prompted to download what looks to be the config
Looks like we have an LFI vulnerability (Local File Inclusion)
With this LFI vulnerability we found we can try to see what processes are running to see what is running on port 1337. Using this command we can get a list of the first 1000 processes running and output it to a processes.txt file so we can search for anything interesting.
for i in {1..1000}; curlhttp://backdoor.htb/wp-content/plugins/ebook-download/filedownload.php?ebookdownloadurl=/proc/{$i}/cmdline>>processes.txt
The output file looks a bit messy
However we can fix this. Each line from the processes seems to end in <script>window.close()</script>
We can find and replace this with a new line to get each process on its own line
This is much easier to read and we can see a few interesting things. gdbserver seems tto be running on port 1337 and screen seems to be running as root which might be an opportunity for a privilege escalation later.