Delegate
A full AD compromise of the "Delegate" Box. Initial access via hardcoded SMB credentials leads to Domain Admin by chaining Targeted Kerberoasting, Unconstrained Delegation, and PetitPotam coercion.

1. Reconnaissance and Enumeration
The engagement began with a standard port scan using nmap against the target IP (10.129.234.69).
The scan revealed a Windows Server 2022 machine acting as a Domain Controller for delegate.vl. Standard Active Directory ports were open, including DNS (53), Kerberos (88), LDAP (389, 636, 3268, 3269), SMB (445), and WinRM (5985).
With SMB open, the next step was to check for null session or Guest access using NetExec (nxc).
SMB Share Enumeration: Logging in as the
Guestuser with a blank password successfully enumerated the standardNETLOGONandSYSVOLshares.
RID Brute Forcing: Using the Guest session, RID brute-forcing revealed several custom domain users, including
A.Briggs,N.Thompson, and a custom group nameddelegation admins.
2. Initial Access
Accessing the NETLOGON share anonymously via smbclient revealed a script named users.bat. Downloading and inspecting this batch file yielded hardcoded credentials for a domain user:
Username:
[email protected]Password:
P4ssw0rd1#123
Further enumeration using these valid credentials confirmed that the ms-DS-MachineAccountQuota attribute was set to the default value of 10, meaning standard users could add up to 10 computer accounts to the domain.
3. Lateral Movement: Targeted Kerberoasting
With a foothold as A.Briggs, the next phase involved enumerating Active Directory object permissions using bloodyAD.
The output revealed a critical misconfiguration: A.Briggs had WRITE (GenericWrite) privileges over the user object N.Thompson.
This permission allows an attacker to modify attributes on the target user. To exploit this, a Targeted Kerberoasting attack was executed:
Setting a Fake SPN: Because
A.Briggshas write access,bloodyADwas used to register a dummy Service Principal Name (fake/service) onN.Thompson's account. This action transformsN.Thompsoninto a service account in the eyes of Active Directory.
Requesting the Ticket: Impacket's
GetUserSPNs.pywas then used to request a Ticket Granting Service (TGS) ticket for this newly created SPN. The Domain Controller responded with the ticket, which is encrypted withN.Thompson's password hash.
Offline Cracking: The TGS hash was saved and run through
hashcat(mode 13100) using therockyou.txtwordlist. The password was successfully cracked in under 10 seconds:
N.Thompson's Password: KALEB_2341
Using these new credentials, WinRM access was achieved via evil-winrm, and the user.txt flag was captured.
4. Privilege Escalation: Unconstrained Delegation and Coercion
Logging in as N.Thompson provided a deeper level of access. Because N.Thompson belongs to the delegation admins group, they possess elevated privileges regarding delegation settings.
The path to Domain Admin involved abusing Unconstrained Delegation combined with NTLM coercion.
Step 4a: Infrastructure Setup
Creating a Machine Account: Impacket's
addcomputer.pywas used to create a new computer account nameddelegator$with a known password.
Enabling Unconstrained Delegation: bloodyAD was used to modify the userAccountControl property of delegator$, adding the TRUSTED_FOR_DELEGATION flag.
DNS and SPN Configuration: To ensure the upcoming relay attack routed correctly, dnstool.py added an A record pointing delegator.delegate.vl to the attacker's IP address. addspn.py then registered a CIFS SPN to the delegator$ account.
Step 4b: Coercion and TGT Capture
With the trap set, krbrelayx.py was started on the attacker machine, listening for incoming connections and configured to extract Kerberos tickets.
Next, PetitPotam was used to coerce the Domain Controller (DC1) into authenticating against the attacker-controlled machine (delegator.delegate.vl).
When
DC1reached out to the attacker machine, it saw theTRUSTED_FOR_DELEGATIONflag.Because of Unconstrained Delegation,
DC1sent its own Ticket Granting Ticket (TGT) along with the authentication request, allowing the service to impersonate the DC.krbrelayxsuccessfully captured the TGT for[email protected]and saved it to a.ccachefile.
Step 4c: DCSync and Domain Admin
The captured TGT effectively granted the attacker the identity of the Domain Controller itself.
The
KRB5CCNAMEenvironment variable was exported to use the captured TGT.Impacket's
secretsdump.pywas executed to perform a DCSync attack. Because the DC has replication rights, it dumped the NTDS.DIT secrets, yielding the NTLM hash for theAdministratoraccount
Finally, a Pass-The-Hash attack via
evil-winrmprovided an interactive shell as theAdministrator, allowing for the retrieval of theroot.txtflag.
5. Executive Summary
During the engagement against the delegate.vl environment, multiple critical Active Directory misconfigurations were identified and chained together to achieve complete domain compromise. The attack path transitioned from unauthenticated enumeration to Domain Admin by exploiting a combination of poor credential management, overly permissive Access Control Lists (ACLs), and dangerous delegation settings.
Attack Path Overview:
Anonymous Access: Guest access to SMB shares revealed a batch script containing hardcoded domain credentials.
Insecure ACLs: The compromised user possessed
GenericWriteprivileges over another user account, allowing the attacker to register a Service Principal Name (SPN) and perform a Targeted Kerberoasting attack to capture their password.Privilege Escalation: The second compromised user had the ability to configure Active Directory delegation. By creating a new machine account, configuring it for Unconstrained Delegation, and forcing the Domain Controller to authenticate to it (via PetitPotam), the attacker captured the Domain Controller's TGT, ultimately dumping the NTDS.dit database and retrieving the Domain Administrator hash.
6. Remediations & Mitigations
To secure the delegate.vl domain against the attack vectors demonstrated in this write-up, the following remediation steps should be implemented:
A. Secure SMB and Credential Management
Disable Guest/Anonymous Access: Ensure that anonymous and Guest access to SMB shares (like
NETLOGONandSYSVOL) is strictly disabled to prevent unauthenticated enumeration.Remove Hardcoded Credentials: Never store passwords in cleartext within logon scripts, batch files, or documentation. Utilize secure password managers or localized LAPS (Local Administrator Password Solution) for credential management.
B. Restrict Machine Account Creation
Modify
ms-DS-MachineAccountQuota: By default, Active Directory allows any authenticated user to add up to 10 computer accounts to the domain. This attribute should be changed from10to0to prevent attackers from creating arbitrary machine accounts for use in delegation and relay attacks.
C. Audit Active Directory ACLs (Targeted Kerberoasting)
Enforce Least Privilege: Review Active Directory object permissions, specifically looking for users or groups with unnecessary
GenericAll,GenericWrite, orWritePropertypermissions over other users.A.Briggsshould not have had the ability to modifyN.Thompson's attributes.Strong Passwords: Ensure that any account requiring an SPN (Service Accounts) utilizes a complex, randomly generated password of at least 25-30 characters to make Kerberoasting offline cracking mathematically infeasible.
D. Mitigate Unconstrained Delegation & Coercion
Disable Unconstrained Delegation: Unconstrained delegation is a legacy feature that is inherently unsafe because it caches the TGT of any user who authenticates to the service. Transition all services using Unconstrained Delegation to Constrained Delegation or Resource-Based Constrained Delegation (RBCD).
Protect Sensitive Accounts: Add highly privileged users (like Domain Admins) to the Protected Users security group, and check the "Account is sensitive and cannot be delegated" box on their AD account objects. This prevents their credentials from being delegated even if they authenticate to a compromised server.
Patch RPC Coercion Vulnerabilities: Apply the latest Microsoft security patches to mitigate MS-EFSRPC (PetitPotam) coercion attacks. Additionally, consider disabling the EFS service on Domain Controllers if it is not actively required.
Enforce SMB Signing: Require SMB signing across the domain to prevent NTLM relay attacks from being used to compromise other endpoints.
Last updated