Detect Make and Impersonate Token in IBM QRadar
Adversaries may make new tokens and impersonate users to escalate privileges and bypass access controls. If an adversary has a username and password but the user is not logged onto the system, the adversary can create a logon session for the user using the LogonUser function. The function returns a copy of the new session's access token, which the adversary can use with SetThreadToken to assign to a thread. This is distinct from Token Impersonation/Theft (T1134.001) because it creates a new user token rather than stealing or duplicating an existing one. Real-world threat actors including Cobalt Strike operators (make_token), FIN13 (Incognito V2), BlackByte, SILENTTRINITY, and the Mafalda implant use this technique to escalate privileges or move laterally using known credentials without spawning a new interactive session visible to the target user.
MITRE ATT&CK
- Technique
- T1134 Access Token Manipulation
- Sub-technique
- T1134.003 Make and Impersonate Token
- Canonical reference
- https://attack.mitre.org/techniques/T1134/003/
QRadar Detection Query
SELECT
DATEFORMAT(starttime, 'YYYY-MM-dd HH:mm:ss') AS event_time,
logsourcename(logsourceid) AS log_source,
CATEGORYNAME(category) AS event_category,
QIDNAME(qid) AS event_name,
eventid,
username,
"LogonType" AS logon_type,
"ProcessName" AS calling_process,
"SubjectUserName" AS subject_user,
"TargetUserName" AS target_user,
"SubjectDomainName" AS subject_domain,
"TargetDomainName" AS target_domain,
sourceip,
destinationip,
CASE
WHEN eventid = 4624 AND "LogonType" = '9' THEN 'NewCredentials_LogonType9'
WHEN eventid = 4648 THEN 'ExplicitCredentials_4648'
ELSE 'Unknown'
END AS detection_branch
FROM events
WHERE LOGSOURCETYPEID(devicetype) IN (12, 253)
AND (
(
eventid = 4624
AND "LogonType" = '9'
AND username NOT LIKE '%$'
AND username NOT IN ('', '-', 'ANONYMOUS LOGON')
AND "ProcessName" NOT ILIKE '%lsass.exe'
AND "ProcessName" NOT ILIKE '%winlogon.exe'
AND "ProcessName" NOT ILIKE '%services.exe'
AND "ProcessName" NOT ILIKE '%svchost.exe'
)
OR
(
eventid = 4648
AND "TargetUserName" NOT IN ('', '-')
AND "SubjectUserName" NOT LIKE '%$'
AND (
"ProcessName" ILIKE '%cmd.exe'
OR "ProcessName" ILIKE '%powershell.exe'
OR "ProcessName" ILIKE '%pwsh.exe'
OR "ProcessName" ILIKE '%mshta.exe'
OR "ProcessName" ILIKE '%wscript.exe'
OR "ProcessName" ILIKE '%cscript.exe'
OR "ProcessName" ILIKE '%rundll32.exe'
OR "ProcessName" ILIKE '%regsvr32.exe'
OR "ProcessName" ILIKE '%msbuild.exe'
)
)
)
ORDER BY starttime DESC
LAST 24 HOURS IBM QRadar AQL query targeting Windows Security Event Log sources (LOGSOURCETYPEID 12 and 253 — adjust values per your QRadar DSM deployment) for T1134.003. Detects LogonType 9 (NewCredentials) from Event 4624, which is the direct fingerprint of the LogonUser() Windows API call used to create impersonation tokens without an interactive session, plus Event 4648 (explicit credential use) from scripting interpreters and LOLBins. The CASE expression labels each hit with its detection branch. LOGSOURCETYPEID values may differ across QRadar versions and DSM packs; verify with SELECT DISTINCT LOGSOURCETYPEID(devicetype), logsourcetypename FROM events LAST 1 HOURS.
Data Sources
Required Tables
False Positives & Tuning
- Enterprise password vault agents (CyberArk, BeyondTrust, Thycotic) that programmatically call LogonUser() to verify or rotate credentials generate frequent LogonType 9 events from their service host processes.
- Service accounts used by IT automation platforms (ServiceNow MID server, SolarWinds Orion, ManageEngine) that authenticate against domain resources using stored credentials produce 4648 events, sometimes from cmd.exe or powershell.exe launcher wrappers.
- Software packaging and deployment tools (SCCM/ConfigMgr client, Chocolatey, Ansible WinRM) that run msbuild.exe or powershell.exe to install or configure software under a service account context will match the 4648 branch.
Other platforms for T1134.003
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 1Make Token via runas /netonly (LogonType 9 Baseline Test)
Expected signal: Security Event 4624 (LogonType=9, NewCredentials): SubjectUserName=<current user>, TargetUserName=dftest, TargetDomainName=<domain>, ProcessName=C:\Windows\System32\runas.exe, LogonType=9. Sysmon Event 1: runas.exe process creation with CommandLine containing '/netonly'. A UAC credential dialog will appear requesting the password for dftest — enter any value; the LogonType 9 event fires regardless of password correctness because validation is deferred.
- Test 2Make Token via PowerShell P/Invoke LogonUser API Call
Expected signal: Security Event 4624 (LogonType=9) or 4625 (failed logon): AccountName=dftest, LogonType=9, ProcessName contains powershell.exe. Sysmon Event 1: powershell.exe CommandLine containing 'LogonUserW', 'advapi32', 'T1134003Test'. PowerShell ScriptBlock Log Event 4104: full Add-Type DllImport definition captured. Even if 4625 (failure) fires instead of 4624, the LogonType=9 attribute is still present in the event.
- Test 3Invoke-TokenManipulation Enumerate Available Tokens
Expected signal: Sysmon Event 1: powershell.exe with CommandLine containing 'Invoke-TokenManipulation', 'make_token'. PowerShell ScriptBlock Log Event 4104: captures the Invoke-Expression and function definition. No Security Event 4624/4648 fires unless -CreateProcess or -Username with credentials is used — this tests the command-line-pattern detection branch only.
- Test 4Explicit Credential Network Authentication (Event 4648 Test)
Expected signal: Security Event 4648: SubjectUserName=<current user>, TargetUserName=dftest, TargetServerName=127.0.0.1, ProcessName=cmd.exe. Security Event 4625 (failed logon) with LogonType=3 if password is wrong. Sysmon Event 3: network connection from cmd.exe to 127.0.0.1:445 (SMB). This specifically exercises the Event 4648 detection branch where the calling process is an interactive shell — the highest-confidence signal for lateral movement using explicit credentials.
References (10)
- https://attack.mitre.org/techniques/T1134/003/
- https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-logonuserw
- https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreadtoken
- https://learn.microsoft.com/en-us/windows/win32/secauthz/access-tokens
- https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4624
- https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4648
- https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=4624
- https://github.com/PowerShellMafia/PowerSploit/blob/master/Exfiltration/Invoke-TokenManipulation.ps1
- https://www.cobaltstrike.com/blog/windows-access-tokens-and-alternate-credentials
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1134.003/T1134.003.md
Unlock Pro Content
Get the full detection package for T1134.003 including response playbook, investigation guide, and atomic red team tests.