Command line builds a new logon token for impersonation
AN1375 is a five-step API/event chain — suspicious command, LogonUser*/ SetThreadToken API evidence, a 4624 New Logon with no interactive desktop, a child process running under the new LogonId, and optional follow-on privileged activity — and lib/sigma has no join, so this rule targets only step (1), the one link in that chain with a command line: MITRE's own example of "runas /netonly" or a "PowerShell P/Invoke of LogonUser". The first selection matches runas.exe invoked with /netonly, which creates a new logon session for an alternate credential without validating it against the domain — the classic CLI proxy for LogonUser-style token creation. The second matches a process command line that names both a token-creation API (LogonUser or LsaLogonUser) and an impersonation API (SetThreadToken or ImpersonateLoggedOnUser) together, the P/Invoke or Add-Type pattern offensive PowerShell tooling uses to call both from a single script passed inline. Neither selection sees the technique when the actual API calls are made in-process by injected or compiled code, or when the PowerShell is wrapped in -EncodedCommand, since the base64 blob hides the literal API names from CommandLine — that path leaves no command-line evidence at all. The brief's second logsource, Security 4672 (Special Privileges Assigned to New Logon), is not used: it fires for every logon carrying an administrative-equivalent privilege set — built-in admins, most service accounts, scheduled tasks, IIS app pools — and it has no process field to filter against MITRE's own AllowedImpersonators knob (winlogon.exe, lsass.exe, IIS worker, trusted service accounts), since 4672 is a logon event, not a process-creation event; without that filter it is far too coarse to carry this technique on its own. Prerequisite: 4688-backed process creation needs *Audit Process Creation* and the separate *Include command line in process creation events* policy, neither on by default. UNVERIFIED AS AUTHORED — derived from MITRE ATT&CK DET0498, not hand-written and not tested by its author. Any lab result is on this rule's own page.Full descriptionShow less
The detection
The 4 SIEM queries below are previews produced by Siemphony’s own translator, not pySigma, and none has been executed against a real backend — review before you deploy.
detection.yml
Sentinel · KQL
Run this as a search.
DeviceProcessEvents| where ((FolderPath endswith "\\runas.exe" and ProcessCommandLine contains "/netonly") or ((ProcessCommandLine contains "LogonUser" or ProcessCommandLine contains "LsaLogonUser") and (ProcessCommandLine contains "SetThreadToken" or ProcessCommandLine contains "ImpersonateLoggedOnUser")))
Splunk · SPL
Run this as a search.
index=* ((Image="*\\runas.exe" AND CommandLine="*/netonly*") OR ((CommandLine="*LogonUser*" OR CommandLine="*LsaLogonUser*") AND (CommandLine="*SetThreadToken*" OR CommandLine="*ImpersonateLoggedOnUser*")))Elastic · ES|QL
Run this as a search.
FROM logs-*| WHERE ((TO_LOWER(process.executable) LIKE "*\\\\runas.exe" AND TO_LOWER(process.command_line) LIKE "*/netonly*") OR ((TO_LOWER(process.command_line) LIKE "*logonuser*" OR TO_LOWER(process.command_line) LIKE "*lsalogonuser*") AND (TO_LOWER(process.command_line) LIKE "*setthreadtoken*" OR TO_LOWER(process.command_line) LIKE "*impersonateloggedonuser*")))
Wazuh · XML rule
Deploy to your manager — this is a rule, not a search.
<group name="sigma,windows,process_creation,"> <!-- Rule ids must be unique on your manager; 100000+ is the user range. --> <!-- 2 rules: the Sigma condition ORs across different fields, which one rule cannot express. Any one matching is a hit. --> <rule id="100000" level="7"> <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. --> <field name="Image" type="pcre2">(?i)\\runas\.exe$</field> <field name="CommandLine" type="pcre2">(?i)/netonly</field> <description>Command line builds a new logon token for impersonation (1/2)</description> <mitre> <id>T1134.003</id> </mitre> </rule> <rule id="100001" level="7"> <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. --> <field name="CommandLine" type="pcre2">(?i)(LogonUser|LsaLogonUser)</field> <field name="CommandLine" type="pcre2">(?i)(SetThreadToken|ImpersonateLoggedOnUser)</field> <description>Command line builds a new logon token for impersonation (2/2)</description> <mitre> <id>T1134.003</id> </mitre> </rule></group>
Verdicts · reactions · comments
Community
Verdicts from engineers who actually deployed it, and the conversation around it.
Nobody has run this in a real environment and said what happened.
Verdicts from engineers who deployed it
0 castNo verdicts reported yet. The first one is worth more than the tenth — say what you ran it against.
Log in to report a verdict.
Log in to join the discussion.
No comments yet. Someone who deploys this will have something to say about it.