T1134 Google Chronicle · YARA-L

Detect Access Token Manipulation in Google Chronicle

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

Tactic
Defense Evasion Privilege Escalation
Technique
T1134 Access Token Manipulation
Canonical reference
https://attack.mitre.org/techniques/T1134/

YARA-L Detection Query

Google Chronicle (YARA-L)
yaral
rule access_token_manipulation_t1134 {
  meta:
    author = "Argus Detection Engineering"
    description = "Detects Windows access token manipulation via known tools, PowerShell API abuse, or suspicious privilege assignments (T1134)"
    severity = "HIGH"
    priority = "HIGH"
    mitre_attack_tactic = "Privilege Escalation, Defense Evasion"
    mitre_attack_technique = "T1134"
    mitre_attack_url = "https://attack.mitre.org/techniques/T1134/"
    reference = "https://attack.mitre.org/techniques/T1134/"
    yara_l_version = "2.0"
    false_positives = "Service accounts with legitimate SeDebugPrivilege, authorized red team activities"

  events:
    (
      // Branch 1: Known token manipulation tools
      (
        $e.metadata.event_type = "PROCESS_LAUNCH"
        and (
          re.regex($e.target.process.file.full_path, `(?i)(juicypotato|printspoofer|sweetpotato|godpotato|roguewinrm|rottenpotatong|incognito|tokenvator)`)
          or re.regex($e.target.process.command_line, `(?i)(juicypotato|printspoofer|sweetpotato|godpotato|roguewinrm|incognito|tokenvator)`)
        )
      )
      or
      // Branch 2: PowerShell token API abuse
      (
        $e.metadata.event_type = "PROCESS_LAUNCH"
        and re.regex($e.target.process.file.full_path, `(?i)(powershell\.exe|pwsh\.exe)`)
        and re.regex($e.target.process.command_line, `(?i)(Invoke-TokenManipulation|Get-SecurityToken|DuplicateTokenEx|OpenProcessToken|AdjustTokenPrivileges|CreateProcessWithToken|ImpersonateLoggedOnUser|SetThreadToken|NtImpersonateThread|Invoke-RunAs|SeDebugPrivilege|SeAssignPrimaryTokenPrivilege|SeTcbPrivilege|SeCreateTokenPrivilege)`)
      )
      or
      // Branch 3: Suspicious special privilege assignment (Event ID 4672 equivalent)
      (
        $e.metadata.event_type = "USER_PRIVILEGE_ESCALATION"
        and not re.regex($e.principal.user.userid, `(?i)(\$$|^SYSTEM$|^LOCAL SERVICE$|^NETWORK SERVICE$|^DWM-|^UMFD-)`)
        and re.regex($e.target.resource.name, `(?i)(SeDebugPrivilege|SeAssignPrimaryTokenPrivilege|SeTcbPrivilege|SeCreateTokenPrivilege)`)
      )
    )

  condition:
    $e
}
high severity high confidence

Chronicle YARA-L 2.0 rule detecting Windows access token manipulation (T1134) across three detection branches: execution of known Potato-family and token theft tools, PowerShell invoking Windows token manipulation APIs or sensitive privilege constants, and USER_PRIVILEGE_ESCALATION events where non-service interactive accounts receive high-value token privileges. Uses UDM normalized event types and field paths.

Data Sources

Windows Security Event Log via Chronicle forwarderSysmon via Chronicle Windows sensorEndpoint telemetry via Chronicle SIEM agent

Required Tables

UDM events: PROCESS_LAUNCH, USER_PRIVILEGE_ESCALATION

False Positives & Tuning

  • Managed service accounts (MSAs) and group managed service accounts (gMSAs) for SQL Server, IIS, or Exchange that receive high-privilege tokens at service start — these end in '$' and should be excluded by the account filter, but custom naming conventions may bypass the filter.
  • Security orchestration platforms (Splunk SOAR, Palo Alto XSOAR) that execute PowerShell runbooks with token management functions for automated incident response.
  • Software deployment systems (SCCM, Intune) that use CreateProcessWithToken for deploying packages under the SYSTEM context may generate false positives on endpoints with verbose logging.
Download portable Sigma rule (.yml)

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.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections