Page cover

MonitorsThree

Synopsis

MonitorsThree is a medium linux machine created by ruycr4ft and kavigihan. The http service hosts the monitorsthree.htb domain. The vhost cacti.monitorsthree.htb uses the cacti version 1.2.26 which is vulnerable to CVE-2024-25641 arbitrary file write vulnerability. The domain has forget-password.php which is vulnerable to sql injection and the cacti login credentials is gained. CVE-2024-25641 is exploited using the gained credentials which gives us a shell as www-data. The cacti config file has a mysql crediantials. Logging into the mysql database gives us the marcus user password, we change the user to marcus and fetch the id_rsa for ssh login. The marcus runs the duplicati service in port 8200, we can bypass the duplicati login and exploit to gain the shell as root.

OS
Difficulty
Points
Release Date
Retired Date

Linux

Medium

30

24-08-2024

18-01-2025


OSINT

Previous Machines

The previously released Monitors and MonitorsTwo machinces are vulnerable to sql injection and command injection, the vhost cacti or domain uses the cacti service and the user marcus is present.


Enumeration

Nmap

Started the nmap scan and found the ssh and http services running.

nmap -Pn -sC -sV --min-rate=500 10.10.11.30 
Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-01-13 19:56 EST
Nmap scan report for 10.10.11.30
Host is up (1.9s latency).
Not shown: 65533 closed tcp ports (reset)
PORT     STATE SERVICE  VERSION
22/tcp   open     ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
80/tcp   open     http    nginx 1.18.0 (Ubuntu)
|_http-title: Did not follow redirect to http://monitorsthree.htb/
|_http-server-header: nginx/1.18.0 (Ubuntu)

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 55.60 seconds

Add the monitorsthree.htb and cacti.monitorsthree.htb into /etc/hosts file.

Web - monitorsthree.htb

The monitorsthree provides the networking solutions to the businesses.

The login page provides us the login form and forget password form is vulnerable to sql injection. It is also conformed that the user admin is present because the password reset instruction is send successfully. The payload I have used for identifying the sql injection is given below.

The syntax error conforms that the database is MariaDB database.

Web - cacti.monitorsthree.htb

The vhost cacti is present and it is using cacti version 1.2.26 which is vulnerable to CVE-2024-25641 and can be exploited using metasploit once we get the cacti login credentials.


Exploit

SQL Injection - forget-password

The sql injection found in domain is exploited using sqlmap for gaining cacti login credentials.

  • Intercept the forget password request using burpsuite.

  • Copy and paste the request into the file.

circle-info

I have termited the sqlmap during user dumping when I have extracted the admin hash.

The admin hash is crack-able using hashcat and rockyou.txt. It gives us the credentials for cacti.

The crediantials for cacti is admin:greencacti2001

Foothold

Shell - www-data

The gained crediantials can be used for CVE-2024-25641 vulnerability. Use the metasploit for exploiting the vulnerability. The more details about the CVE is found here.


Privilege Escalation

Pillaging - www-data [user]

The www-data has a cacti config file which contains the password for mysql and the auth_user table contains the user marcus hash which is crackable using rockyou.txt wordlist.

Shell - marcus

Crack the hash using the hashcat.

The password cannot be used for ssh login as marcus but we can change the user to marcus using the su from the previously gained shell and copy the id_rsa file to ssh into it.

Copy and paste the id_rsa into local machine file and change the permissions.

circle-info

The user.txt file contains the user flag 👏

Pillaging - marcus [user]

The marcus user is running the duplicati service in port 8200.

Duplicati is a free, open-source backup client that securely stores encrypted, incremental, and compressed backups on cloud storage services and remote file servers.

Searching the duplicti folder leads us to config folder which contains the Duplaciti-server.sqlite file.

Downloading the Duplicati-server.sqlite using scp and enumearting it using sqlite3.

Exploit - Duplicati Login Authentication Bypass with server-passphrase

The duplicati is vulnerable to login authentication using server-passphrase. The below post shows us the PoC for duplicati login bypass using server-passphrase.

  • Port Forward the 8200 port via ssh.

  • The Duplicati-server.sqlite contains the server-passphare in Option table.

  • The login.js has a login logic. It can be used to craft the password and authenticate our-self.

circle-info

The salt value is converted into base64 and then into hexdecimal.

  • Intercept the duplicati login request using burpsuite. Don't forward the login.cgi POST request with password parameter and get the nounce. The salt also matches with the duplicati database.

  • Convert the server-passphrase value into base64 and then into hexadecimal.

  • Once we get the above hex we can generate the valid password using above hex and nounce.

  • Open the dev-tool console and paste the below code.

  • Copy the printed string in console and paste it into password paramater. URL encode the password by pressing Ctrl + U then forward the request.

  • If successful we will get the duplicati index page or we will get the authentication fail alter.

Shell - root

The accessed duplicati can be used to copy the content of the system and restore it into marcus home directory or vice-versa. I tried backing up the id_rsa of root user but it was not present. The marcus has a authorized_keys file in /home/marcus/.ssh directory which we can backup and restore it into /root/.ssh directory and we can ssh into root from marus.

  • Create the backup of authorized_keys and restore it into the /root/.ssh directory.

Creating Backup
Restoring backup
circle-info

The root.txt file contains the root flag 🎉

Proof of Concept

The below video provides the PoC of MonitorsThree machine.

Last updated