Detect Access Token Manipulation in CrowdStrike LogScale
Adversaries may modify access tokens to operate under a different user or system security context to perform actions and bypass access controls. Windows uses access tokens to determine the ownership of a running process. A user can manipulate access tokens to make a running process appear as though it is the child of a different process or belongs to someone other than the user that started the process. When this occurs, the process also takes on the security context associated with the new token. An adversary can use built-in Windows API functions to copy access tokens from existing processes (token stealing) and either apply them to an existing process or spawn a new one. An adversary must already be in a privileged user context to steal a token, but commonly uses token stealing to escalate from administrator to SYSTEM. Any standard user can use the runas command and Windows API functions to create impersonation tokens without administrator access.
MITRE ATT&CK
- Technique
- T1134 Access Token Manipulation
- Canonical reference
- https://attack.mitre.org/techniques/T1134/
LogScale Detection Query
// Branch 1: Known token manipulation tool execution
#event_simpleName = "ProcessRollup2"
| FileName = /(?i)(juicypotato|printspoofer|sweetpotato|godpotato|roguewinrm|rottenpotatong|incognito|tokenvator)/
OR ImageFileName = /(?i)(juicypotato|printspoofer|sweetpotato|godpotato|roguewinrm|rottenpotatong|incognito|tokenvator)/
OR CommandLine = /(?i)(juicypotato|printspoofer|sweetpotato|godpotato|roguewinrm|incognito|tokenvator)/
| eval DetectionType = "KnownTokenTool"
| eval IsPotatoFamily = if(CommandLine = /(?i)(juicypotato|printspoofer|sweetpotato|godpotato)/, "true", "false")
| table timestamp, ComputerName, UserName, FileName, CommandLine, ParentBaseFileName, DetectionType, IsPotatoFamily
// Branch 2: PowerShell token API abuse
| union [
#event_simpleName = "ProcessRollup2"
| FileName = /(?i)(powershell\.exe|pwsh\.exe)/
| CommandLine = /(?i)(Invoke-TokenManipulation|Get-SecurityToken|DuplicateTokenEx|OpenProcessToken|AdjustTokenPrivileges|CreateProcessWithToken|ImpersonateLoggedOnUser|SetThreadToken|NtImpersonateThread|Invoke-RunAs|SeDebugPrivilege|SeAssignPrimaryTokenPrivilege|SeTcbPrivilege|SeCreateTokenPrivilege)/
| eval DetectionType = "PowerShellTokenAbuse"
| eval IsPotatoFamily = "false"
| table timestamp, ComputerName, UserName, FileName, CommandLine, ParentBaseFileName, DetectionType, IsPotatoFamily
]
// Branch 3: Suspicious privilege assignment events
| union [
#event_simpleName = "UserAccountAddedToGroup" OR #event_simpleName = "UserPrivilegeGained"
| UserName != /\$$/
| UserName != /(?i)^(SYSTEM|LOCAL SERVICE|NETWORK SERVICE|DWM-|UMFD-)/
| Privileges = /(?i)(SeDebugPrivilege|SeAssignPrimaryTokenPrivilege|SeTcbPrivilege|SeCreateTokenPrivilege)/
| eval DetectionType = "SuspiciousPrivilegeAssignment"
| eval IsPotatoFamily = "false"
| eval CommandLine = Privileges
| table timestamp, ComputerName, UserName, TargetProcessId, CommandLine, DetectionType, IsPotatoFamily
]
| sort timestamp desc CrowdStrike LogScale (Falcon) detection for Windows access token manipulation (T1134). Uses ProcessRollup2 events to detect known token abuse tool execution and PowerShell-based token API misuse, plus privilege assignment events for suspicious high-value privilege grants to interactive user accounts. Three branches are unioned to provide comprehensive coverage across token theft and impersonation patterns.
Data Sources
Required Tables
False Positives & Tuning
- CrowdStrike Falcon sensor itself and other EDR agents running as SYSTEM may generate ProcessRollup2 events that superficially match token manipulation patterns during process injection for monitoring purposes.
- Enterprise password management tools (CyberArk PSM, BeyondTrust) that use token-based session isolation for privileged access management will generate privilege assignment events that match the SuspiciousPrivilegeAssignment branch.
- Legitimate use of the Windows 'runas /savecred' or 'runas /netonly' commands by IT administrators for accessing network resources without full impersonation will generate token-related events that partially overlap with the PowerShell abuse branch if scripted.
Other platforms for T1134
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.
- Test 1Invoke-TokenManipulation via PowerSploit
Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe, CommandLine containing 'Invoke-TokenManipulation' and 'Net.WebClient'. Sysmon Event ID 3: Network connection to raw.githubusercontent.com. PowerShell ScriptBlock Log Event ID 4104 with the full Invoke-TokenManipulation script content after download. Security Event 4672 may fire if the token enumeration triggers a privilege check.
- Test 2AdjustTokenPrivileges — Enable SeDebugPrivilege via PowerShell
Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe, CommandLine containing 'AdjustTokenPrivileges', 'OpenProcessToken', 'LookupPrivilegeValue', and 'SeDebugPrivilege'. PowerShell ScriptBlock Log Event ID 4104 with the P/Invoke code. Security Event 4672 may fire once the privilege adjustment is applied to the current process token.
- Test 3PrintSpoofer — SeImpersonatePrivilege Abuse to SYSTEM
Expected signal: Sysmon Event ID 1: Process Create for PrintSpoofer64.exe with CommandLine '-i -c whoami'. Sysmon Event ID 1: Child process cmd.exe or whoami.exe spawned from PrintSpoofer64.exe running as NT AUTHORITY\SYSTEM. System Event 7045 (Service Control Manager): a transient service briefly installed by PrintSpoofer to coerce the spooler token. Sysmon Event ID 3: Named pipe connection from PrintSpoofer to the spooler pipe.
- Test 4RunAs with Explicit Credentials — Token Creation via LogonUser
Expected signal: Security Event 4648: Logon Using Explicit Credentials — records the calling process (cmd.exe), the target account (testuser), and the logon GUID. Security Event 4624: New Logon with LogonType=2 (interactive) for the new session. Sysmon Event ID 1: cmd.exe spawned with runas as parent, running in the context of testuser. Security Event 4672 if testuser holds special privileges.
References (12)
- https://attack.mitre.org/techniques/T1134/
- https://pentestlab.blog/2017/04/03/token-manipulation/
- https://www.blackhat.com/docs/eu-17/materials/eu-17-Atkinson-A-Process-Is-No-One-Hunting-For-Token-Manipulation.pdf
- https://learn.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-adjusttokenprivileges
- https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-openprocesstoken
- https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createprocesswithtokenw
- https://github.com/itm4n/PrintSpoofer
- https://github.com/ohpe/juicy-potato
- https://github.com/PowerShellMafia/PowerSploit/blob/master/Exfiltration/Invoke-TokenManipulation.ps1
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1134/T1134.md
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-deviceprocessevents-table
- https://learn.microsoft.com/en-us/azure/sentinel/understand-threat-intelligence
Unlock Pro Content
Get the full detection package for T1134 including response playbook, investigation guide, and atomic red team tests.