Return
https://app.hackthebox.com/machines/Return
Nmap
Add "10.10.11.108 return.local" to /etc/hosts.
I ran through various standard Active Directory checks such as username and LDAP enumeration. I was not able to pick up results of interest.
Checking our port 80 we come to the root page "HTB Printer Admin Panel".
We also have an a page of interest under /settings.php
.
Looking through the PHP source code we are unable to identify anything of interest to us. Opening up ZAP proxy and running the default settings through the "Update" button we get the output below.
We can see in the body of the POST request we have the target systems hostname. From here I set a nc
listener on my attacking system to the port specified in the /settings.php
page.
Then edited the post request in ZAP Proxy to point back to my attacking system IP.
And, after sending the request we are sent back a password for the account svc-printer.
A quick test against SMB
and WinRM
with crackmapexec
proves the credentials are valid.
From here we can use Evil WinRM
to log in as the svc-printer user.
Now, with low level access on the Domain Controller we can look for path to privilege escalation. Doing some basic membership checks with whoami /groups
shows we are a member of the "Server Operators" group.
Server Operators: https://docs.microsoft.com/en-us/windows/security/identity-protection/access-control/active-directory-security-groups
This group, gives user multiple interesting permissions. Namely, the ability to create, delete and reconfigure services.
The medium article below shows a good outline on how to use this to escalate privileges.
On the target system at hand we will be doing this with the spooler service. We can use any server that is running in an elevated context however if we wish to.
First we double check the intended binary path for the spooler service.
We can then check the ACL's over the service. Below we see the owner is SYSTEM and the "Server Operators" group has the ability to "SetValue" which allows us to reconfigure the binary path.
On our attacking system we generate a x64 reverse shell executable.
Then transfer over to the target system with Evil WinRM
.
From here we can add a registry value that changes the binary path to the payload we just uploaded.
a nc
listener is set on the attacking system.
Then a reboot is initiated on the target system. When the system reboots the Spooler service will come up and execute the reverse shell binary.
Landing us a SYSTEM shell.
Last updated