Mentor
Executive summary — Mentor only exposes SSH and HTTP over TCP, but the real entry point lives in SNMP over UDP, a port a conventional TCP scan never reveals. From there the box is a chain of six reused secrets without a single CVE involved: SNMP leaks a process's command line (and with it a password), that password grants admin access to a FastAPI API with a backup endpoint vulnerable to command injection, the resulting RCE lands inside a Docker container whose source code holds PostgreSQL credentials, the database stores user passwords as unsalted MD5, and two of those passwords are reused verbatim as system SSH credentials — the second one with
sudoover/bin/shat the very end.
| Platform | Hack The Box |
| Operating system | Linux |
| Difficulty | Medium |
| Status | Retired |
| Target IP | 10.129.x.x |
Attack map
[22,80] mentorquotes.htb — TCP only; SNMP UDP/161 invisible to the TCP scan
▼
[161/udp] SNMP — "internal" community (onesixtyone misses it, snmpwalk finds it)
│ hrSWRunParameters -> "login.py <password>" in the process command line
▼
[FastAPI] api.mentorquotes.htb — login as james (admin) with that password
│ /admin/backup (undocumented) — blind command injection via "path"
▼
[RCE] root INSIDE the Docker container (BusyBox, no bash)
│ /app/app/db.py -> postgres:postgres@172.22.0.1/mentorquotes_db
│ users table -> MD5 hashes for james and svc; svc cracks with rockyou
▼
[SSH] svc (user.txt) — DB password reused as the system account password
│ /etc/snmp/snmpd.conf -> james's password in clear text (createUser bootstrap)
▼
[SSH] james — password from snmpd.conf reused
│ sudo (ALL) /bin/sh, unrestricted
▼
[ROOT] root.txt
1. Reconnaissance
ping -c 3 -W 3 mentorquotes.htb
ttl=63 (64 minus one hop) points to Linux. Full TCP scan:
nmap -p- --min-rate 5000 -T4 -Pn -oN nmap-allports.txt mentorquotes.htb
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
Only two ports, with no obvious web vector behind them — easy to get stuck here. Version detection to confirm the base system:
nmap -sCV -p22,80 -Pn -oN nmap-services.txt mentorquotes.htb
22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3 (Ubuntu Linux; protocol 2.0)
80/tcp open http Apache httpd 2.4.52 ((Ubuntu))
|_http-title: Did not follow redirect to http://mentorquotes.htb/
OpenSSH 8.9p1 + Apache 2.4.52 confirm Ubuntu 22.04. When TCP offers so little surface, the mandatory next reflex — the one a lot of people skip because it's slow and noisy — is checking UDP, where services like SNMP live:
sudo nmap -sU --top-ports 50 -T4 -Pn -oN nmap-udp.txt mentorquotes.htb
PORT STATE SERVICE
161/udp open snmp <- INVISIBLE to the TCP scan
161/udp — SNMP open. This port never shows up in a TCP scan, and it changes the whole machine: SNMP exposes system management data (processes, software, network) to anyone who knows the community string that works as its password.
Resumen ejecutivo — Mentor solo expone SSH y HTTP por TCP, pero el vector real vive en SNMP sobre UDP, un puerto que un escaneo TCP convencional nunca revela. A partir de ahí la máquina es una cadena de seis secretos reutilizados sin un solo CVE de por medio: SNMP filtra la línea de comandos de un proceso (y con ella una contraseña), esa contraseña da acceso admin a una API FastAPI con un endpoint de backup vulnerable a inyección de comandos, el RCE resultante ocurre dentro de un contenedor Docker cuyo código fuente guarda credenciales de PostgreSQL, la base de datos guarda contraseñas de usuario en MD5 sin salt, y dos de esas contraseñas se reutilizan tal cual como credenciales SSH del sistema — la segunda de ellas con
sudosobre/bin/shal final del camino.
| Plataforma | Hack The Box |
| Sistema operativo | Linux |
| Dificultad | Medium |
| Estado | Retired |
| IP objetivo | 10.129.x.x |
Mapa del ataque
[22,80] mentorquotes.htb — solo TCP; SNMP UDP/161 invisible al escaneo TCP
▼
[161/udp] SNMP — comunidad "internal" (onesixtyone falla, snmpwalk sí la encuentra)
│ hrSWRunParameters -> "login.py <password>" en la línea de comandos
▼
[FastAPI] api.mentorquotes.htb — login como james (admin) con esa password
│ /admin/backup (no documentado) — inyección de comandos ciega en "path"
▼
[RCE] root DENTRO del contenedor Docker (BusyBox, sin bash)
│ /app/app/db.py -> postgres:postgres@172.22.0.1/mentorquotes_db
│ tabla users -> hashes MD5 de james y svc; el de svc cae con rockyou
▼
[SSH] svc (user.txt) — password de BD reutilizada como password de sistema
│ /etc/snmp/snmpd.conf -> password de james en claro (createUser bootstrap)
▼
[SSH] james — password de snmpd.conf reutilizada
│ sudo (ALL) /bin/sh sin restricción
▼
[ROOT] root.txt
1. Reconocimiento
ping -c 3 -W 3 mentorquotes.htb
ttl=63 (64 − 1 salto) apunta a Linux. Escaneo TCP completo:
nmap -p- --min-rate 5000 -T4 -Pn -oN nmap-allports.txt mentorquotes.htb
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
Solo dos puertos, y sin un vector web evidente detrás — es fácil quedarse atascado aquí. Detección de versiones para confirmar el sistema base:
nmap -sCV -p22,80 -Pn -oN nmap-services.txt mentorquotes.htb
22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3 (Ubuntu Linux; protocol 2.0)
80/tcp open http Apache httpd 2.4.52 ((Ubuntu))
|_http-title: Did not follow redirect to http://mentorquotes.htb/
OpenSSH 8.9p1 + Apache 2.4.52 confirman Ubuntu 22.04. Cuando el TCP ofrece tan poca superficie, el siguiente reflejo obligado —y el que mucha gente se salta por lo lento y ruidoso que es— es mirar UDP, donde viven servicios como SNMP:
sudo nmap -sU --top-ports 50 -T4 -Pn -oN nmap-udp.txt mentorquotes.htb
PORT STATE SERVICE
161/udp open snmp <- INVISIBLE al escaneo TCP
161/udp — SNMP abierto. Este puerto no aparece en ningún escaneo TCP y cambia por completo la máquina: SNMP expone información de gestión del sistema (procesos, software, red) a quien conozca la cadena de comunidad que actúa como contraseña.
This content is Root Access only. Everything else on the site — the free tier, the whole public library — stays open.
See Root Access plansNo account? Create one free then upgrade from your console.
Este contenido es solo para Root Access. Todo lo demás del sitio — el nivel gratuito, toda la biblioteca pública — sigue abierto.
Ver planes de Root Access¿Sin cuenta? Crea una gratis y luego mejora desde tu consola.