HackTheBox - Forest Writeup
Nmap
Like always, I’m going to scan the IP Address by using nmap but I’m going to scan the full port first. Then, I’m going to scan the only open ports.
|
|
The nmap scan result is completed and that’s a bunch of open ports. Based on the ports itself, it’s look like a Domain Controller
.
On top of that, nmap also found the domain name called htb.local
. So, I’m going to add that to the /etc/hosts
file.
LDAP: ldapsearch
This machine doesn’t have any web server to check it out and I tried to list the SMB
shares with anonymous access and it failed. Then, I’ll start to enumerate the LDAP
server by using ldapsearch
and find a list of users. I saved those lists of users in the file called users.txt
.
Unfortunately, I was stuck at this point and did not know what to do next. However, HacktheBox just released a new feature called Guided Mode which is the perfect training companion for beginners. I used that as an advantage and it says, I need to find a user who has Kerberos Pre-Authentication
disabled.
Impacket: GetNPUsers.py
Based on the description above, I need to find a user that is vulnerable to an asreproast
attack. Then, I executed the impacket script called GetNPUsers.py
alongside the list of users and it did not find anything at all.
Rpcclient: enumdomusers
Then, I remembered that rpcclient
can be used to enumerate users
on this machine. After successfully establishing a connection with anonymous access. I searched the users by executing the enumdomusers
command and it did manage to find another user which is svc-alfresco
.
ASREPRoast: GetNPUsers.py
With that information in hand, I’ll execute the GetNPUsers.py
script once again. Instead of using a list of users, I’m going to dump the hash of the svc-alfresco
user only. After successfully dumping the hash, I’m going to crack it using hashcat.
Evil-winrm: svc-alfresco
Since I already have valid credentials, I’m going to connect to it as a svc-alfresco
user. I’m in as a svc-alfresco
user.
BloodHound
After successfully logging in. I’m going to drop the SharpHound binary in the machine for enumerating the Active Directory
using the upload
command provided by evil-winrm. Then, I executed it and saved the output into the zip
file.
For analyzing the zip
file data. I’m going to fire up the neo4j console
with the sudo
privilege. I’ll start up the BloodHound
and import the zip
file by clicking the Upload Data
button on the right navigation bar.
After successfully importing the data. I’ll search for [email protected]
node and Mark User as Owned
by right-clicking on the node.
Now, I’m going to analyze the data from the owned user which is svc-alfresco
by clicking the burger menu
on the top left and clicking the Analysis
button, and choosing the Shortest Paths to High Value Targets
.
Groups: Account Operators
Honestly, the graph view is confusing. However, the current user is a member of SERVICE ACCOUNT
-> PRIVILEGED IT ACCOUNT
-> ACCOUNT OPERATORS
and with quick googling, I found Microsoft documentation about it. Turns out, the Account Operators
group, it’s a quite powerful group in this case, which can be used to create and modify accounts.
The Account Operators
group has GenericAll
permission on the Exchange Windows Permissions
groups. This permission essentially gives members full control of the group and allows members to directly modify group membership.
On top of that, the EXCHANGE WINDOWS PERMISSIONS
group has WriteDacl
permission on the domain HTB.LOCAL
and it can be used to abuse the DCSync
attack on the domain.
By right-clicking the WriteDacl
button and Help
menu. Another window will appear by giving some information on that permission. I’ll click the Windows Abuse section and it shows the steps on how to abuse it.
Based on the information above, I’ll create another user called shafiq
on the target machine and added to the Exchange Windows Permissions
groups.
Impacket: secretsdump.py
I’ll upload the PowerView.ps1 to the target machine, which is located at /usr/share/windows-resources/powersploit/Recon/PowerView.ps1
on the Kali machine and imported into my current PowerShell session like this . .\PowerView.ps1
. Then, I’ll give the DCSync
rights to the shafiq
user by executing the command below.
|
|
After successfully executing the commands without any errors. I’ll start to perform the DCSync
attack by using another impacket script called secretsdump.py
by supplying shafiq’s credential.
PsExec
Then, I’ll use another impacket script called psexec.py
and log in as Administrator
using the technique called Pass-The-Hash
and it succeeds. I’m in as NT AUTHORITY\SYSTEM
.