Create Process with Token
Adversaries may create a new process with an existing token to escalate privileges and bypass access controls. Processes can be created with the token and resulting security context of another user using features such as CreateProcessWithTokenW, CreateProcessAsUser, and runas. Creating processes with a token not associated with the current user may require the credentials of the target user, specific privileges to impersonate that user, or access to the token to be used. The token could be duplicated via Token Impersonation/Theft (T1134.001) or created via Make and Impersonate Token (T1134.003) before being used to create a new process. This technique has been observed in campaigns by Turla, Lazarus Group, KONNI, Azorult, Bankshot, REvil, WhisperGate, and Empire post-exploitation frameworks.
let SuspiciousScriptParents = dynamic(["cmd.exe", "powershell.exe", "pwsh.exe", "wscript.exe", "cscript.exe", "mshta.exe", "rundll32.exe", "regsvr32.exe", "msiexec.exe", "wmic.exe"]);
DeviceProcessEvents
| where Timestamp > ago(24h)
| where (
// Branch 1: Integrity level escalation — child runs High/System but parent is Medium/Low
// and that parent is a scripting engine with no legitimate elevation path
(ProcessIntegrityLevel in ("High", "System")
and InitiatingProcessIntegrityLevel in ("Medium", "Low")
and InitiatingProcessFileName in~ (SuspiciousScriptParents)
and FileName !in~ ("consent.exe", "werfault.exe", "dllhost.exe"))
or
// Branch 2: Account context switch — process runs as a different named user than its parent
// Excludes well-known service accounts which legitimately change user context
(AccountName != InitiatingProcessAccountName
and not (AccountName has_any ("SYSTEM", "LOCAL SERVICE", "NETWORK SERVICE", ""))
and not (InitiatingProcessAccountName has_any ("SYSTEM", "LOCAL SERVICE", "NETWORK SERVICE", ""))
and InitiatingProcessFileName in~ (SuspiciousScriptParents))
or
// Branch 3: runas.exe acting as parent — explicit token-based process creation
// Excludes expected child processes of a normal runas UAC flow
(InitiatingProcessFileName =~ "runas.exe"
and FileName !in~ ("consent.exe", "werfault.exe"))
or
// Branch 4: AdvancedRun.exe — NirSoft utility weaponized by WhisperGate for TrustedInstaller-level execution
(FileName =~ "AdvancedRun.exe"
or InitiatingProcessFileName =~ "AdvancedRun.exe")
)
| extend
IntegrityEscalation = (ProcessIntegrityLevel in ("High", "System")
and InitiatingProcessIntegrityLevel in ("Medium", "Low")
and InitiatingProcessFileName in~ (SuspiciousScriptParents)
and FileName !in~ ("consent.exe", "werfault.exe", "dllhost.exe")),
AccountContextSwitch = (AccountName != InitiatingProcessAccountName
and not (AccountName has_any ("SYSTEM", "LOCAL SERVICE", "NETWORK SERVICE", ""))
and not (InitiatingProcessAccountName has_any ("SYSTEM", "LOCAL SERVICE", "NETWORK SERVICE", ""))
and InitiatingProcessFileName in~ (SuspiciousScriptParents)),
RunasParent = (InitiatingProcessFileName =~ "runas.exe"
and FileName !in~ ("consent.exe", "werfault.exe")),
AdvancedRunTool = (FileName =~ "AdvancedRun.exe" or InitiatingProcessFileName =~ "AdvancedRun.exe")
| project Timestamp, DeviceName, AccountName, InitiatingProcessAccountName,
FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine,
ProcessIntegrityLevel, InitiatingProcessIntegrityLevel,
IntegrityEscalation, AccountContextSwitch, RunasParent, AdvancedRunTool
| sort by Timestamp desc Data Sources
Required Tables
False Positives
- Software installation tools and MSI packages that legitimately spawn elevated child processes via runas.exe or UAC prompts during setup routines
- System administration scripts that use runas to execute maintenance tasks under alternate credentials as part of a least-privilege administrative workflow
- IT automation platforms (SCCM, Ansible WinRM, PDQ Deploy) that execute tasks as a service account distinct from the initiating agent process, producing account context switches
- Security products and EDR agents that intentionally spawn sub-processes under SYSTEM context for real-time monitoring or remediation, creating integrity level differences
- Developer workstations where engineers routinely use runas or IDE-triggered elevation to test code requiring elevated privilege in a controlled environment
References (9)
- https://attack.mitre.org/techniques/T1134/002/
- https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createprocesswithtokenw
- https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessasusera
- https://docs.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtsqueryusertoken
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-deviceprocessevents-table
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1134.002/T1134.002.md
- https://github.com/SigmaHQ/sigma/tree/master/rules/windows/process_creation
- https://technet.microsoft.com/en-us/windows-server-docs/identity/ad-ds/manage/component-updates/command-line-process-auditing
- https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc771525(v=ws.11)
Unlock Pro Content
Get the full detection package for T1134.002 including response playbook, investigation guide, and atomic red team tests.