Unconstrained Delegation
Introduction
Unconstrained delegation is a feature in Microsoft Active Directory (AD) that allows a server or service to impersonate any user who authenticates to it. This is done by granting the server access to the user's Kerberos Ticket-Granting Tickets (TGTs), which are stored in memory. While designed to support scenarios where a service needs to act on behalf of a user across multiple resources, unconstrained delegation introduces significant security risks if misconfigured or exploited by attackers.
Unconstrained delegation is classified under the Credential Access and Privilege Escalation tactics in the MITRE ATT&CK Framework, as it allows attackers to elevate privileges, impersonate users, and move laterally within a network.
How Unconstrained Delegation Works
Kerberos Delegation Overview:
In Kerberos authentication, a TGT is issued to users, allowing them to request service tickets without re-entering credentials.
Delegation allows a service or computer to use a user's credentials to access other services on their behalf.
Unconstrained Delegation Mechanism:
When unconstrained delegation is enabled, a server or service receives the TGT of any user who authenticates to it.
The server can then use the TGT to impersonate the user and access other resources in the domain.
Misuse by Attackers:
If attackers compromise a machine or service account with unconstrained delegation, they can extract TGTs from memory using tools like Mimikatz.
Extracted TGTs enable attackers to impersonate domain users, including Domain Admins, and move laterally within the network.
Risks Associated with Unconstrained Delegation
Exposure of TGTs:
Any TGT stored in memory on an unconstrained delegation-enabled system is at risk of being stolen.
Privilege Escalation:
If high-privilege accounts (e.g., Domain Admins) authenticate to an unconstrained delegation-enabled service, their TGTs can be used to escalate privileges.
Lateral Movement:
Attackers can use the stolen TGTs to impersonate users and access other systems or resources in the domain.
Stealthy Persistence:
Attackers can maintain access by exploiting unconstrained delegation-enabled systems without modifying existing user accounts.
How Attackers Exploit Unconstrained Delegation
Environment Discovery:
Attackers enumerate domain objects to identify computers or services with unconstrained delegation enabled. This can be done using tools like BloodHound or PowerShell commands.
For example:
Compromise Target System:
The attacker compromises a machine or service account configured for unconstrained delegation.
Extract TGTs:
Using tools like Mimikatz, the attacker dumps the TGTs of users who authenticated to the system.
Impersonate Users:
The attacker uses the stolen TGTs to impersonate domain users, including privileged accounts.
Indicators of Unconstrained Delegation Abuse
Unusual Logons:
Logon events (Event ID 4624) from service accounts or machines configured for unconstrained delegation.
Abnormal Account Usage:
Service accounts or computers accessing resources they typically do not interact with.
Enumeration Activities:
Attackers running commands or tools to identify unconstrained delegation-enabled systems.
Kerberos TGT Requests:
Multiple Kerberos TGT requests (Event ID 4768) from a single source.
Mitigation Strategies
Restrict Delegation:
Avoid enabling unconstrained delegation whenever possible. Use constrained delegation or resource-based constrained delegation (RBCD) instead.
Audit and Monitor:
Regularly audit domain controllers, servers, and service accounts for unconstrained delegation:
Network Segmentation:
Segregate high-value resources (e.g., domain controllers) from systems configured for delegation.
Log and Monitor for Anomalies:
Monitor for Kerberos ticket requests, especially TGT requests from unconstrained delegation-enabled systems.
Protect Privileged Accounts:
Ensure privileged accounts like Domain Admins do not log into systems configured for unconstrained delegation.
The following security controls should be implemented to mitigate unconstrained delegation:
Ensure computer objects are not configured for unconstrained delegation. If delegation is required for a computer object, use resource-based constrained delegation instead.
Ensure privileged user objects are configured as ‘sensitive and cannot be delegated’. This can be configured by using the ‘Account is sensitive and cannot be delegated’ option on the user object in Active Directory Users and Computers.
Ensure privileged user objects are members of the Protected Users security group. Members of this security group cannot be delegated.
Disable the Print Spooler service on Domain Controllers. This prevents the Print Spooler service from being used to coerce a Domain Controller into authenticating to another system.
Detection Techniques
Identify Systems with Unconstrained Delegation:
Query Active Directory for machines and accounts with the
TrustedForDelegation
attribute enabled.
Monitor TGT Access:
Detect suspicious access to Kerberos TGTs using Event IDs 4768, 4769, and 4624.
Logon Monitoring:
Flag unexpected logons from accounts or services configured for delegation.
Events that detect an unconstrained delegation compromise:
Event ID 4103: Event generated when PowerShell executes and logs pipeline execution details.
Event ID 4104: Event generated when PowerShell executes code to capture scripts and commands.
Event ID 4624: Event generated when malicious actors need to authenticate to a computer object configured for unconstrained delegation.
Event ID 4688: Event generated when a new process is created, such as extracting TGTs from the LSASS process (this is commonly done using malicious tools)
Event ID 4770: Event generated when a TGT is renewed. By default, TGTs have a maximum lifetime of seven days; however, malicious actors may choose to renew a TGT to extend its lifetime.
Unconstrained delegation is a powerful feature but poses significant security risks when misconfigured or exploited. By understanding how it works, recognising its risks, and implementing proper controls, organisations can minimise their exposure to delegation-based attacks. Proactive auditing, monitoring, and replacing unconstrained delegation with more secure alternatives (e.g., constrained delegation) are essential steps to strengthen Active Directory security.
KQL Detection Queries
To detect systems or accounts with Unconstrained Delegation in Active Directory using KQL in Microsoft Sentinel, you can query Active Directory event logs or configuration data. Specifically, you'll look for objects where the TrustedForDelegation attribute is set to true.
Query for Unconstrained Delegation Detection
Query performs the following steps:
Identifies systems with unconstrained delegation enabled by looking for Event ID 4742.
Monitors TGT requests from these systems by looking for Event ID 4768.
Combines the results to identify suspicious activity, such as multiple TGT requests from unique IPs.
Splunk Detection Queries
To detect Unconstrained Delegation in Splunk, you can query Windows Event Logs for specific configurations or changes in the TrustedForDelegation attribute. These changes are typically logged under Event ID 4742 (A computer account was changed) and Event ID 5136 (Directory Service Object Modified).
Splunk Query to Detect Unconstrained Delegation Changes
Explanation of the Query
Target Events:
EventCode=4742: Logs changes to computer accounts in Active Directory.
EventCode=5136: Captures modifications to directory objects, such as the TrustedForDelegation attribute.
Attribute Filtering:
Focus on changes where the
TrustedForDelegation
attribute is modified.
Field Extraction:
ModifiedAccount
: The account or object whose delegation setting was changed.InitiatorAccount
: The user or account that initiated the change.
Summarize and Aggregate:
Count the number of delegation changes (
ChangeCount
).Group by
ComputerName
to identify affected systems.Capture the first and last modification times (
FirstSeen
,LastSeen
).
Filter and Present:
Exclude results with no delegation changes (
ChangeCount > 0
).Display key details for SOC analysts to investigate further.
Reference
Last updated