Resource-Based Constrained Delegation (RBCD)
Resource-Based Constrained Delegation (RBCD)
Object: msDS-AllowedToActOnBehalfOfOtherIdentity
Tools: rbcd.py , rubeus.exe , getST , addcomputer.py
Requirements
Get-DomainObject -Identity "dc=domain,dc=local" -Domain domain.localGet-NetComputer ws01 | Select-Object -Property name, msds-allowedtoactonbehalfofotheridentity
Standard RBCD
1) Add RBCD from ServiceA to ServiceB
2) Verify property
3) Get ServiceA TGT and then S4U
Linux
1) Add RBCD from ServiceA to ServiceB
2) Verify property
With machine account creation
1) Add a fake machine account in the domain
2) Add it to the msds-allowedtoactonbehalfofotheridentity attribute of the target machine
Linux
3) Use the S4USelf function with the fake machine (on an arbitrary SPN) to create a forwardable ticket for a wanted user (not protected)
4) Use the S4UProxy function to obtain a ST for the impersonated user for the wanted service on the target machine
Skip S4U2Self
Linux
Reflective RBCD
Linux
Impersonate protected user via S4U2Self request
Linux
Bypass Constrained Delegation restrictions with RBCD
Linux
U2U RBCD with SPN-less accounts
1) Configure the machine account to trust the user account you control (NTLM Relay, with the machine account's creds,...)
2) Obtain a TGT for the user via pass-the-hash:
3) Request a Service Ticket via U2U (S4USelf request) with the previous TGT specified in /tgs: (additional ticket added to the request body identifying the target user account) and /ticket: (authentication). If U2U is not used, the KDC cannot find the account's LT key when a UPN is specified instead of a SPN. The account to impersonate via the future S4U request is also present:
4) Retrieve the TGT session key in HEX format
6) Now, change the user's long term key (his RC4 NT hash actually) to be equal to the TGT session key. The ST sent in the S4UProxy is encrypted with the session key, but the KDC will try to decipher it with the user's long term key, this is why the LT key must be equal to the session key (WARNING !!! The user's password is now equal to an unknown value, you have to use a sacrificial account to realise this attack).
7) Realize the S4UProxy request with the previous S4USelf U2U ticket (ciphered with the session key) as additional ticket and the original TGT as ticket:
8) Finally, use this ticket to do whatever you want!
Linux
1) Configure the machine account to trust the user account you control (NTLM Relay, with the machine account's creds,...). Obtain a TGT for the user via pass-the-hash and extract the session key from it with this
2) ow, change the user's long term key (his RC4 NT hash actually) to be equal to the TGT session key. The ST sent in the S4UProxy will be encrypted with the session key, but the KDC will try to decipher it with the user's long term key, this is why the LT key must be equal to the session key (WARNING !!! The user's password is now equal to an unknown value, you have to use a sacrificial account to realise this attack).
3) Realize the S4USelf request with a U2U request. If U2U is not used, the KDC cannot find the account's LT key when a UPN is specified instead of a SPN. Then, use the ticket obtained in the U2U S4USelf request (ciphered with the session key), to perform a S4UProxy request.
RBCD from MSSQL Server
1) Create a DNS record in order to be able to leak the NTLM hash externally
2) Use the xp_dirtree (or xp_fileexist) function to the created DNS record on @80. This will force the authentication and leak the hash
3) Relay the machine hash to the LDAP server to add a controlled account (with a SPN for the further S4USelf request) to the msDS-AllowedToActOnBehalfOfOtherIdentity of the target machine
4) Now we can ask a ST for a user we want to impersonate for a service on the machine
Linux
Create a new raw security descriptor for the FAKE01 computer principal
Apply the security descriptor bytes to the target machine
Then use Rubeus or getST to impersonate an account on our target computer of our choice
Last updated