Pirate Writeup - HackTheBox
Pirate is a Windows Hard Active Directory box on HackTheBox. Starting credentials: pentest / p3nt3st2025!&. The chain runs: BloodHound reveals the Pre-Windows 2000 Compatible Access group grants unauthenticated enumeration, nxc pre2k recovers machine account default passwords giving MS01$ and EXCH01$ access, MS01$ can read gMSA passwords so gMSA_ADFS_prod$'s NTLM hash is recovered, evil-winrm onto DC01 as gMSA_ADFS_prod$ exposes an internal 192.168.100.0/24 subnet, Ligolo-ng tunnels to WEB01 (192.168.100.2) which has SMB signing disabled, NTLM coercion from WEB01 relayed to LDAP on DC01 via ntlmrelayx interactive shell writes shadow credentials onto WEB01$, certipy auth with the resulting PFX gives WEB01$'s TGT and NTLM hash, RBCD is then configured with WEB01$ trusting itself, S4U2Self plus S4U2Proxy impersonates Administrator on WEB01, LSA secrets dump recovers a.white cleartext and WEB01 local admin NTLM, ForceChangePassword on a.white_adm resets the privileged account, and constrained delegation with protocol transition on HTTP/WEB01.pirate.htb combined with WriteSPN lets you move the SPN to DC01$ then getST with -altservice CIFS/DC01 for psexec as SYSTEM.
Discovery
Port scan
PORT STATE SERVICE 53/tcp open domain 88/tcp open kerberos-sec 135/tcp open msrpc 139/tcp open netbios-ssn 389/tcp open ldap 443/tcp open https Pirate Portal 445/tcp open microsoft-ds 464/tcp open kpasswd5 593/tcp open http-rpc-epmap 636/tcp open ldapssl 3268/tcp open globalcatLDAP 3269/tcp open globalcatLDAPssl 5985/tcp open http WinRM 9389/tcp open mc-nmf
Standard DC ports. Add hostnames to /etc/hosts:
$TARGET_IP pirate.htb dc01.pirate.htb dc01
Enumeration
BloodHound
BloodHound shows DOMAIN COMPUTERS is a member of Pre-Windows 2000 Compatible Access, which allows unauthenticated LDAP reads on machine account attributes. Machine accounts provisioned without an explicit password receive a default password matching their SAM name (without the trailing $, lowercased).
Pre-Windows 2000 machine account credential recovery
[+] MS01$:ms01 [+] EXCH01$:exch01
Both machine accounts authenticate. MS01$ has the ReadGMSAPassword right on gMSA_ADFS_prod$.
gMSA password read
Account: gMSA_ADFS_prod$ NTLM: $GMSA_ADFS_NTLM
Foothold on DC01
*Evil-WinRM* PS C:\Users\gMSA_ADFS_prod$\Documents>
WinRM session on DC01 as gMSA_ADFS_prod$. Enumerate internal network interfaces:
Ethernet adapter Ethernet0: IPv4 Address. . . . . : 10.10.11.x Ethernet adapter Ethernet1: IPv4 Address. . . . . : 192.168.100.1
Internal subnet 192.168.100.0/24 reachable from DC01. Scan for hosts:
192.168.100.2
WEB01 is at 192.168.100.2. Add to /etc/hosts: 192.168.100.2 web01.pirate.htb WEB01. Tunnel to the subnet using Ligolo-ng.
Lateral Movement to WEB01
Ligolo-ng tunnel
192.168.100.0/24 is now routable from the attacker machine.
SMB signing check on WEB01
SMB 192.168.100.2 445 WEB01 [*] Windows Server 2022 signing:False SMBv1:False
SMB signing disabled on WEB01. NTLM relay is possible.
NTLM coercion and relay to LDAP
Start ntlmrelayx targeting LDAP on DC01 in interactive mode to get an LDAP shell:
Coerce authentication from WEB01 to your machine using PetitPotam or PrinterBug:
[+] Coerce WEB01 auth to $ATTACKER_IP
ntlmrelayx relays WEB01$'s NTLM auth to LDAP on DC01 and opens an interactive LDAP shell on 127.0.0.1:11000. Use it to add shadow credentials to WEB01$:
# Interactive LDAP shell > set_shadow_creds WEB01$
ntlmrelayx outputs the PFX file and its password.
certipy auth to get WEB01$ TGT and NTLM
[+] Got TGT for WEB01$ [+] NTLM hash: $WEB01_NTLM
Administrator on WEB01 via RBCD
Configure RBCD: WEB01$ trusts itself
[*] Attribute msDS-AllowedToActOnBehalfOfOtherIdentity is set
S4U2Self + S4U2Proxy to impersonate Administrator
[*] Getting ST for Administrator on cifs/WEB01 [*] Saved as WEB01_Administrator.ccache
C:\Windows\system32> whoami nt authority\system
SYSTEM on WEB01. Dump LSA secrets to recover cleartext credentials and the local admin NTLM:
pirate.htb\a.white:$A_WHITE_PASSWORD WEB01\Administrator:$WEB01_ADMIN_NTLM
Privilege Escalation to DC01
ForceChangePassword on a.white_adm
a.white has ForceChangePassword on a.white_adm. Reset the privileged account's password:
Constrained delegation with protocol transition
BloodHound shows a.white_adm has constrained delegation with protocol transition configured on HTTP/WEB01.pirate.htb, and has WriteSPN on DC01$. Move the SPN to point at DC01, then request a service ticket for CIFS/DC01:
[+] SPN added
[*] Getting ST for Administrator [*] Saved as Administrator.ccache
C:\Windows\system32> whoami nt authority\system
Related
References
-
Certipy, used for shadow credential auth to obtain TGT and NTLM from the PFX.
-
Impacket suite, getST.py, psexec.py, secretsdump.py, rbcd.py used throughout.
-
Ligolo-ng, used to tunnel to the internal 192.168.100.0/24 subnet.
-
PetitPotam, used to coerce WEB01 NTLM authentication for relay.