Nmap scan:
We can add monitors.htb
to our /etc/hosts
file.
Port 80 hosts a Wordpress site.
We can run wpscan
to enumerate the plugins and version, and this finds that wp-with-spritz is being used.
This version is vulnerable to RFI.
We can confirm this by viewing the /etc/passwd
file.
After further enumeration, there's nothing else that I could find. So we probably need to read more files within this machine. I could not read any user files, so I tried to check some configuration files for the server at /etc/apache2/sites-enabled/000-default.conf
.
We can find a new domain at cacti-admin.monitors.htb
. Afterwards, I also read the Wordpress configuration files at /var/www/wordpress/wp-config.php
to find a password.
Upon visting this separate domain, we are greeted by another login page:
This version of Cacti is old and vulnerable to loads of exploits. We can login with the credentials for Wordpress. Afterwards, we can use an exploit that uses SQL injection to gain a reverse shell.
We now have remote access as the user marcus
and can capture the user flag.
In the user's directory, we find a note.txt
file that points towards a docker image being present.
I read the configuration files at /etc/containerd
, and found that the root
user was running the image.
We can check the open ports of this machine via netstat -tulpn
to see other open ports.
Port 8443 was open and we could access it. The next step is port forwarding.
I used ssh -L 8443:localhost:8443 marcus@monitors.htb
to port forward after dropping my public key in the authorized_keys
folder. Then, I used gobuster
to find hidden directories present:
Visting any of these would redirect us to /content/control/main
, where there is a login page present.
The bottom of the page shows that this is running Apache OFBiz Release 17.12.01, which is vulnerable to loads of exploits, including an RCE one.
We can follow the PoC here to execute it:
Then, we would gain a shell as root in the container.
There was nothing much within this machien that was interesting. I decided to check the capabilities of the container and found that cap_sys_module
was enabled. This allows us to escape the container.
First we need to create a new Kernel module with some C code:
Then we need we need to create a Makefile
:
Get them both into the root directory and start listening on a port. Afterwards, we can run make
and insmod reverse-shell.ko
. This would trigger the reverse shell, and give us a shell as root
.