Windows Access Tokens:

Access tokens are at the core of how Windows manages identity and permissions. As a pentester, understanding how these tokens work — and more importantly, how to abuse them — gives you powerful tools for privilege escalation, lateral movement, and persistence. This guide breaks down all the important Windows access tokens, how they work, and how to leverage them offensively.

An access token is a data structure that contains the security context of a process or thread. It includes:

  • The user’s SID (Security Identifier)
  • Group SIDs
  • Privileges (e.g., SeDebugPrivilege)
  • Integrity level (e.g., Medium, High, System)
  • Token type (Primary or Impersonation)

When a user logs in, Windows creates a primary token. This token is inherited by every process the user launches.

  • Assigned to a process
  • Represents the logged-in user
  • Required for spawning a new process
  • Used in: CreateProcessWithTokenW, CreateProcessAsUser
  • Assigned to a thread
  • Allows impersonation of another user (usually temporarily)
  • Used in: ImpersonateLoggedOnUser, SetThreadToken
LevelDescriptionPentester Use Case
AnonymousCannot identify or impersonate a userUseless
IdentifyCan identify user but not act as themFor recon only
ImpersonateCan impersonate a user locallyUsed in SMB token impersonation, incognito
DelegateCan impersonate a user remotelyRare and powerful, for remote abuse

Use whoami /priv and whoami /groups to inspect token capabilities.

  • Has administrator privileges
  • Split by UAC into standard and elevated
  • Used in: UAC bypass (fodhelper, eventvwr, etc.)
  • Stripped of sensitive privileges by UAC
  • Used when a high-priv user runs a low-priv app
  • Can be elevated via UAC bypass
  • Contains a reference to the filtered and elevated token pair
  • Present in UAC-enabled accounts
  • Detect with:
whoami /groups | findstr "High Mandatory Level"
  • Explicitly stripped of groups and privileges
  • Used for sandboxing (e.g., Office Protected View)
  • Less common in pentesting but relevant for sandbox escape scenarios
  • Used by Windows Services (LocalSystem, NetworkService, LocalService)
  • Common target for service misconfiguration and binary replacement
  • Used by Windows Update services
  • More powerful than SYSTEM in some contexts
  • Advanced persistence and resource modification vector
  • The god-mode token
  • Target for:
    • Potato family exploits (JuicyPotato, PrintSpoofer)
    • Token impersonation
    • SeImpersonate abuse
  • Created during remote authentication
  • Cannot access local resources
  • Important in lateral movement: Not all tokens allow local privilege abuse
  • whoami /all
  • whoami /priv
  • whoami /groups
  • Process Explorer
  • token::list in Mimikatz
  • Mimikatz: privilege::debug, token::elevate, token::impersonate
  • Incognito (Metasploit): list_tokens, impersonate_token
  • Tokenvator: UAC bypass and token manipulation
  • Rubeus: For Kerberos token manipulation (TGT, S4U)
  • CreateProcessWithTokenW: Spawn process with token
  • ImpersonateLoggedOnUser API: Local token abuse
  • Check for split token with whoami /groups
  • Use LOLBAS executables like:
    • fodhelper.exe
    • eventvwr.exe
    • sdclt.exe
  • Use SeDebugPrivilege to open process tokens
  • Tools:
    • mimikatz: token::elevate
    • incognito
    • Manual via Windows API
  • Steal SYSTEM token from a service
  • Impersonate domain admin during SMB relay
  • PrintSpoofer.exe -i -c cmd
  • Capture a high-priv token
  • Duplicate and store it (e.g., with mimikatz or Rubeus)
  • Reuse later for persistence
Token TypeTarget ValueKey Tools / Tactics
PrimaryRun processesCreateProcessWithTokenW
ImpersonationAct as another userImpersonateLoggedOnUser, incognito
ElevatedUAC bypassfodhelper.exe, eventvwr.exe
FilteredDetect and elevateDetect with whoami, elevate via bypass
LinkedBypass opportunityCheck for token pair
RestrictedSandbox contextUseful in escapes
ServiceLocal escalationService misconfigs, DLL hijack
TrustedInstallerModify system resourcesAdvanced persistence
SYSTEMFull local controlPrintSpoofer, Potato exploits
Network LogonLimited lateral movementRecon only
  • Always check your current token integrity: whoami /groups
  • Target processes running as SYSTEM or admin
  • Enumerate tokens on the box using mimikatz or incognito
  • Look for opportunities to impersonate or elevate
  • Combine token abuse with lateral movement (e.g., pass-the-token, token theft + WMI)

In a Windows environment, mastering them turns you from a shell jockey into a domain-owning wizard. Keep this guide close, revisit it often, and abuse with ethics.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top