T1134.001 Elastic Security · Elastic

Detect Token Impersonation/Theft in Elastic Security

Adversaries may duplicate then impersonate another user's existing token to escalate privileges and bypass access controls. DuplicateToken or DuplicateTokenEx are used to clone an existing process token, which is then applied to the current thread via ImpersonateLoggedOnUser or SetThreadToken, or used to create a new process via CreateProcessWithTokenW. This allows an adversary to operate under a different security context — typically a higher-privileged user — without needing that user's credentials. Token theft is commonly performed against LSASS, winlogon, explorer.exe, or other processes running as privileged users, and is a core capability of post-exploitation frameworks including Cobalt Strike (steal_token), Metasploit (incognito), Havoc, SILENTTRINITY, and Pupy. Real-world actors including APT28, Emotet, REvil, Tarrask, and FinFisher have all leveraged this technique.

MITRE ATT&CK

Tactic
Defense Evasion Privilege Escalation
Technique
T1134 Access Token Manipulation
Sub-technique
T1134.001 Token Impersonation/Theft
Canonical reference
https://attack.mitre.org/techniques/T1134/001/

Elastic Detection Query

Elastic Security (Elastic)
eql
any where (
  /* Branch 1: Sysmon EventID 10 — process access to privileged targets with token-theft access masks */
  (
    winlog.event_id == 10 and
    winlog.event_data.TargetImage like~ ("*\\lsass.exe", "*\\winlogon.exe", "*\\csrss.exe", "*\\services.exe", "*\\wininit.exe") and
    winlog.event_data.GrantedAccess in~ ("0x1010", "0x1fffff", "0x1f0fff", "0x143a", "0x0040", "0x40", "0x1410", "0x0002", "0x0004") and
    not winlog.event_data.SourceImage like~ ("*\\MsMpEng.exe", "*\\SenseIR.exe", "*\\SenseCE.exe", "*\\SecurityHealthService.exe", "*\\AzureADConnectAuthenticatio.exe", "*\\csrss.exe", "*\\smss.exe", "*\\wininit.exe")
  ) or
  /* Branch 2: Sysmon EventID 1 — known token manipulation tool execution or C2 post-exploitation CLI patterns */
  (
    winlog.event_id == 1 and
    (
      process.name in~ ("incognito.exe", "tokenvator.exe", "tokenduplicator.exe", "token_manipulator.exe") or
      process.command_line like~ ("*steal_token*", "*impersonate_token*", "*Invoke-TokenManipulation*", "*ImpersonateLoggedOnUser*", "*DuplicateTokenEx*", "*SetThreadToken*", "*getsystem*", "*rev2self*", "*NtFilterToken*", "*SeImpersonatePrivilege*")
    )
  ) or
  /* Branch 3: Windows Security EventID 4672 — high-risk privilege assigned to non-system interactive account */
  (
    winlog.event_id == 4672 and
    (
      winlog.event_data.PrivilegeList like "*SeImpersonatePrivilege*" or
      winlog.event_data.PrivilegeList like "*SeAssignPrimaryTokenPrivilege*" or
      winlog.event_data.PrivilegeList like "*SeTcbPrivilege*" or
      winlog.event_data.PrivilegeList like "*SeDebugPrivilege*"
    ) and
    not winlog.event_data.SubjectUserName like~ "*$" and
    not winlog.event_data.SubjectUserName in~ ("SYSTEM", "LOCAL SERVICE", "NETWORK SERVICE", "ANONYMOUS LOGON") and
    not winlog.event_data.SubjectLogonId in ("0x3e7", "0x3e4", "0x3e5")
  ) or
  /* Branch 4: Sysmon EventID 1 — non-privileged parent spawning SYSTEM-context child process */
  (
    winlog.event_id == 1 and
    winlog.event_data.User like~ "*\\SYSTEM" and
    winlog.event_data.ParentUser != "" and
    not winlog.event_data.ParentUser like~ "*\\SYSTEM" and
    not process.parent.name in~ ("services.exe", "svchost.exe", "wininit.exe", "lsass.exe", "smss.exe", "csrss.exe", "winlogon.exe")
  )
)
high severity high confidence

Four-branch EQL detection for T1134.001 using Sysmon and Windows Security telemetry ingested via Winlogbeat. Branch 1 detects Sysmon EventID 10 process handle acquisition to LSASS/winlogon/csrss/services/wininit with access masks associated with token duplication (TOKEN_DUPLICATE 0x0002, PROCESS_DUP_HANDLE 0x0040, common C2 masks 0x1010 and 0x143a), excluding known legitimate AV/EDR accessors. Branch 2 detects Sysmon EventID 1 process creation matching known token manipulation tool names or post-exploitation framework CLI strings (Cobalt Strike steal_token, Metasploit incognito, PowerSploit Invoke-TokenManipulation). Branch 3 detects Windows Security EventID 4672 where high-risk impersonation privileges are assigned to non-system interactive accounts. Branch 4 detects privilege elevation chains where a non-SYSTEM parent spawns a SYSTEM-context child process via token theft.

Data Sources

Sysmon (Microsoft-Windows-Sysmon/Operational) via WinlogbeatWindows Security Event Log via Winlogbeat

Required Tables

winlog (Winlogbeat index with Sysmon and Security Event Log data)

False Positives & Tuning

  • Legitimate EDR and AV products (CrowdStrike Falcon sensor, Carbon Black, Cortex XDR) that open LSASS for real-time memory inspection — SourceImage allowlist covers common Microsoft products but third-party security tools may require additional entries
  • Domain administrators with SeDebugPrivilege granted via Group Policy will fire Branch 3 on every interactive logon — scope by SubjectLogonType or restrict to non-privileged OU accounts
  • Software deployment and patch management tools that temporarily run child processes under SYSTEM context via impersonation (SCCM, Intune Management Extension) will trigger Branch 4 — add parent process names to exclusion list after verification
Download portable Sigma rule (.yml)

Other platforms for T1134.001


Testing Methodology

Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1DuplicateToken API Call via PowerShell P/Invoke (Self-Token)

    Expected signal: Sysmon Event ID 1: Process Create for powershell.exe with CommandLine containing 'TokenDup', 'DuplicateToken', 'OpenProcessToken'. Sysmon Event ID 7 (ImageLoad): advapi32.dll and kernel32.dll loaded by powershell.exe. PowerShell ScriptBlock Log Event ID 4104 with the full Add-Type block showing DllImport declarations for advapi32.dll token APIs.

  2. Test 2LSASS Process Handle Acquisition (Sysmon EventID 10 Trigger)

    Expected signal: Sysmon Event ID 10 (ProcessAccess): SourceImage=powershell.exe, TargetImage=C:\Windows\System32\lsass.exe, GrantedAccess=0x0400, CallTrace will show the call chain through ntdll.dll → kernel32.dll → the powershell.exe process. This is the primary detection event. Security Event ID 4656 (Handle request) may also appear if object access auditing is enabled.

  3. Test 3ImpersonateLoggedOnUser on Current Process Token

    Expected signal: Sysmon Event ID 1: Process Create for powershell.exe with CommandLine containing 'ImpersonateLoggedOnUser', 'RevertToSelf', 'TokenImp'. PowerShell ScriptBlock Log Event ID 4104 with the full P/Invoke block showing advapi32.dll imports for impersonation APIs. Security Event ID 4672 may fire if the token carries elevated privileges.

  4. Test 4Invoke-TokenManipulation Enumeration via PowerSploit

    Expected signal: Sysmon Event ID 1: powershell.exe process with CommandLine containing 'Invoke-TokenManipulation' and '-Enumerate'. Sysmon Event ID 3: Network connection from powershell.exe to raw.githubusercontent.com on port 443 (for the download). Sysmon Event ID 11: File created at %TEMP%\InvTokMnp.ps1. PowerShell ScriptBlock Log Event ID 4104: multiple events showing the Invoke-TokenManipulation module code and the -Enumerate call. Security Event ID 4672 if the enumeration surfaces elevated token contexts.

Unlock Pro Content

Get the full detection package for T1134.001 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections