infosecfamily
← Back to catalog
HackTheBox  /  Easy

MonitorsFour

Full name: Kravtsov Nikolay Dmitrievich

Educational institution: **** **** *****

Grade: 11

MonitorsFour

1. Initial analysis

A scan was performed using the utility Nmap.

Result:

  • TCP 22 - SSH
  • TCP 80 - HTTP

The SSH service worked on the current version without known public vulnerabilities, so the main attack vector was chosen through the web server (port 80).

After adding the entry to /etc/hosts:

10.10.11.98 monitorsfour.htb

The web interface of the application became available.

2. Obtaining the user flag

Next, you need to scan the directories to understand which attack vector to choose. After scanning, I didn’t find anything interesting except the endpoint /user. It allows you to view user data. When entering the endpoint, the response informs you that you need to enter a token. I tried entering null and non-existent token and on entering null the webserver gave me a user dump with important data like password hashes, names, roles, tokens, usernames - this is incorrect authorization and IDOR on URI /user.

After attacking the hashes using a Brute Force attack, I found the password for the admin user - wonderful1. I couldn't find anything on the /admin page after logging into /login with his password, so I started scanning subdomains. I only found cacti. I also added it to /etc/hosts that I could access.

I tried to log in with the same data, but it didn’t work. I looked at other data from the database and, after trying out different options, the name came up - marcus. After logging in with your details marcus:wonderful1, I noticed that the version is vulnerable to CVE-2025-24367 (CVSS 8.7 HIGH), which can lead to RCE, which can correspondingly lead to Reverse Shell. An authorized user of Cacti can abuse the graph creation and graph template functions to create arbitrary PHP scripts in the root directory of the web application, which leads to remote code execution on the server.

At this point I was stuck. By the end of the second hour of trying to gain access, I was already starting to think that I was going in the wrong direction. However, a person from the HackTheBox discord server reported that the vector is correct, and these are problems with the room - at the moment it is “bugged”, which was confirmed by the pwnbox service from HackTheBox.

So I left this machine. After 24 hours I returned to it, but with a VPS server in Germany - everything began to work perfectly. I got a reverse shell, then I checked /home and realized that I had access to the user marcus. Next, I simply read user.txt.

8a4dea3bd881947497166f57144e1727

3. Obtaining the root flag

A little later I started thinking about how to get the root flag. I thought that I could try to get out of the docker container by mounting the filesystem via alpine, and tried to do this via the Docker API - but when I tried to access it, curl could not get a response.

I thought that the Docker API server might be on the same subnet, so I tried using a bash script to find it, and I was right - I was able to do it.

$ for o in {1..254}; do (curl -s --connect-timeout 1 http://192.168.65.\$o:2375/version 2>/dev/null | grep -q ApiVersion && echo "http://192.168.65.$o:2375") & done; wait

http://192.168.65.7:2375/

I looked at what Docker Images it has:

$ curl http://192.168.65.7:2375/images.json

We found Apline - this is a plus. In a container, we can either compromise the entire machine, or get only the root flag - I chose the second, as it is faster and easier, in fact it is lfi. First, in /version we read that this is wsl - hence the root flag is in /mnt/host/c/Users/Administrator/Desktop. Then we write container.json with approximately the following content:

We send a POST request with its content to the endpoint /containers/create&name=<имя>. Next, we start it (we get the container id, we need the first 12 characters) and read the root flag:

8ba4f4b7c68349f929d94f8f8fe2a25a

4. Vulnerability Summary

Stage/Vulnerability Type of impact CVSS score Possible consequences Result
IDOR User data leak CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

7.5 (HIGH)
- leak of personal data - Password hashes obtained
Using weak passwords Brute Force attack and account compromise CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N

9.1 (CRITICAL)
- leak of personal data - Received password for user admin

- Gained access to the Cacti panel
CVE-2025-24367 Remote Code Execution (RCE) CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

8.8 (HIGH)
- implementation of backdoors

- using a server in a botnet

- compromise of other network nodes
- In theory, a complete takeover of the server is possible
Open Docker API Complete compromise of the host system via unauthenticated access to the Docker API CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

9.6  (CRITICAL)
- Full host compromise - Receiving LFI on the host machine

5. Complete chain of compromise

  1. Port scanning
  2. Web Service Discovery
  3. Exploiting IDOR → obtaining hashes
  4. Brute force → obtaining a password
  5. Access to Cacti
  6. RCE Exploitation (CVE-2025-24367)
  7. Getting reverse shell
  8. Docker API discovery
  9. Creating a privileged container
  10. Mounting the host file system
  11. Getting the root flag

6. Remediation recommendations

  1. Removing IDOR on the /users endpoint:

    Necessary:

    1.  Реализовать серверную проверку авторизации, либо дать доступ только серверу на такие эндпоинты
    2.  Исключить прямую передачу очевидных идентификаторов: нужно использовать криптографически стойкие токены
    3.  Реализовать RBAC (Role-Based Access Control)
    4.  Минимизировать возвращаемые данные (чтобы только напрямую обращаясь к базе данных можно было получить пароль)
    5.  Вести аудит доступа к подобным эндпоинтам.
    
  2. Strengthening account security:

    Necessary:

    1.  Изменить алгоритм хеширования на более сильный с большим количеством раундов, например, bcrypt, sha512 или sha256
    2.  Ввести политику сложности паролей, чтобы пользователи и **ДАЖЕ АДМИНИСТРАТОР** мог создать пользователя только с определенными условиями (например, 12 символов минимум, хотя бы одна прописная и хотя бы одна заглавная буква, хотя бы один спецсимвол)
    3.  Реализовать защиту от Brute Force атак на странице входа (например, с помощью rate limiting)
    4.  Провести лекцию работникам, чтобы те поменяли пароли.
    
  3. Fixing CVE vulnerability in Cacti:

    Necessary: Update to version 1.2.29 or patch Cacti.

  4. Eliminating the exposed Docker API:

    Necessary:

    1.  Отключить небезопасный Docker API, если не нужен
    2.  Включить TLS-аутентификацию (если он необходим)
    3.  Ограничить сетевую доступность Docker API (если он необходим): нужно разрешить доступ только для определенных ip даже внутри сети
    4.  Изолировать контейнеры от управляющих интерфесов
    5.  Запускать контейнеры с минимальными необходимыми привилегиями
    6.  Мониторить, регулярно проводить аудит и логировать обращения к Docker API.