Environment-keyed conditional execution on the command line
The observable MITRE describes is a burst of discovery followed by execution that only proceeds when the collected values match an expected target — a threshold over a time window, which Sigma has no construct for. What survives into a single event is the shape of the guardrail itself: a command line that both reads an environment-identifying value and compares it. This rule therefore requires two matches on CommandLine, one for the identity source MITRE lists under EnvironmentalArtifactList (hostname, domain, logon server, hardware UUID, AD or interface enumeration) and one for the conditional operator that gates the payload on it. Discovery alone is left to T1082; neither the four-activity threshold nor the discovery-to-execution delay is encoded here, because faking them would need fields that do not exist. UNVERIFIED AS AUTHORED — derived from MITRE ATT&CK DET0562, 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
title: Environment-keyed conditional execution on the command lineid: ce7e4089-ab36-41ec-828f-22846147096astatus: experimentaldescription: | The observable MITRE describes is a burst of discovery followed by execution that only proceeds when the collected values match an expected target — a threshold over a time window, which Sigma has no construct for. What survives into a single event is the shape of the guardrail itself: a command line that both reads an environment-identifying value and compares it. This rule therefore requires two matches on CommandLine, one for the identity source MITRE lists under EnvironmentalArtifactList (hostname, domain, logon server, hardware UUID, AD or interface enumeration) and one for the conditional operator that gates the payload on it. Discovery alone is left to T1082; neither the four-activity threshold nor the discovery-to-execution delay is encoded here, because faking them would need fields that do not exist. UNVERIFIED AS AUTHORED — derived from MITRE ATT&CK DET0562, not hand-written and not tested by its author. Any lab result is on this rule's own page.references: - https://attack.mitre.org/techniques/T1480 - https://attack.mitre.org/detectionstrategies/DET0562author: Siemphony pipeline (machine-derived from MITRE ATT&CK v19.2)date: 2026-08-16tags: - attack.defense-evasion - attack.t1480logsource: category: process_creation product: windowsdetection: selection_environment: CommandLine|contains: - 'env:COMPUTERNAME' - 'env:USERDOMAIN' - 'env:USERDNSDOMAIN' - 'env:LOGONSERVER' - 'Win32_ComputerSystem' - 'Win32_ComputerSystemProduct' - 'csproduct get uuid' - 'computersystem get domain' - 'GetHostByName' - 'GetIPGlobalProperties' - 'Get-ADDomain' - 'DirectoryServices.ActiveDirectory' - 'NetworkInformation.NetworkInterface' selection_conditional: CommandLine|contains: - ' -eq ' - ' -ne ' - ' -match ' - ' -like ' - ' -contains ' - '.Equals(' - 'if(' - 'if (' condition: selection_environment and selection_conditionalfalsepositives: - "Configuration management, imaging and login scripts, which are built almost entirely out of this pattern — read the hostname or domain, branch on it, apply the matching policy. This is the dominant source of noise and no field in a process creation event separates it from a guardrail; MITRE's EnvironmentalArtifactList knob is the place to narrow the identity terms to values an attacker would key on rather than ones your own scripts branch on." - "Software inventory and licensing agents that query Win32_ComputerSystemProduct for the hardware UUID and compare it against a registered value before continuing." - "Health-check and monitoring one-liners that resolve a hostname or enumerate interfaces and test the result before reporting, especially on domain controllers and jump hosts where they run on a schedule." - "Administrative PowerShell typed interactively, where a single command line commonly contains both an environment lookup and a comparison operator with no payload behind it at all."level: mediumSentinel · KQL
Run this as a search.
DeviceProcessEvents| where ((ProcessCommandLine contains "env:COMPUTERNAME" or ProcessCommandLine contains "env:USERDOMAIN" or ProcessCommandLine contains "env:USERDNSDOMAIN" or ProcessCommandLine contains "env:LOGONSERVER" or ProcessCommandLine contains "Win32_ComputerSystem" or ProcessCommandLine contains "Win32_ComputerSystemProduct" or ProcessCommandLine contains "csproduct get uuid" or ProcessCommandLine contains "computersystem get domain" or ProcessCommandLine contains "GetHostByName" or ProcessCommandLine contains "GetIPGlobalProperties" or ProcessCommandLine contains "Get-ADDomain" or ProcessCommandLine contains "DirectoryServices.ActiveDirectory" or ProcessCommandLine contains "NetworkInformation.NetworkInterface") and (ProcessCommandLine contains " -eq " or ProcessCommandLine contains " -ne " or ProcessCommandLine contains " -match " or ProcessCommandLine contains " -like " or ProcessCommandLine contains " -contains " or ProcessCommandLine contains ".Equals(" or ProcessCommandLine contains "if(" or ProcessCommandLine contains "if ("))
Splunk · SPL
Run this as a search.
index=* ((CommandLine="*env:COMPUTERNAME*" OR CommandLine="*env:USERDOMAIN*" OR CommandLine="*env:USERDNSDOMAIN*" OR CommandLine="*env:LOGONSERVER*" OR CommandLine="*Win32_ComputerSystem*" OR CommandLine="*Win32_ComputerSystemProduct*" OR CommandLine="*csproduct get uuid*" OR CommandLine="*computersystem get domain*" OR CommandLine="*GetHostByName*" OR CommandLine="*GetIPGlobalProperties*" OR CommandLine="*Get-ADDomain*" OR CommandLine="*DirectoryServices.ActiveDirectory*" OR CommandLine="*NetworkInformation.NetworkInterface*") AND (CommandLine="* -eq *" OR CommandLine="* -ne *" OR CommandLine="* -match *" OR CommandLine="* -like *" OR CommandLine="* -contains *" OR CommandLine="*.Equals(*" OR CommandLine="*if(*" OR CommandLine="*if (*"))Elastic · ES|QL
Run this as a search.
FROM logs-*| WHERE ((TO_LOWER(process.command_line) LIKE "*env:computername*" OR TO_LOWER(process.command_line) LIKE "*env:userdomain*" OR TO_LOWER(process.command_line) LIKE "*env:userdnsdomain*" OR TO_LOWER(process.command_line) LIKE "*env:logonserver*" OR TO_LOWER(process.command_line) LIKE "*win32_computersystem*" OR TO_LOWER(process.command_line) LIKE "*win32_computersystemproduct*" OR TO_LOWER(process.command_line) LIKE "*csproduct get uuid*" OR TO_LOWER(process.command_line) LIKE "*computersystem get domain*" OR TO_LOWER(process.command_line) LIKE "*gethostbyname*" OR TO_LOWER(process.command_line) LIKE "*getipglobalproperties*" OR TO_LOWER(process.command_line) LIKE "*get-addomain*" OR TO_LOWER(process.command_line) LIKE "*directoryservices.activedirectory*" OR TO_LOWER(process.command_line) LIKE "*networkinformation.networkinterface*") AND (TO_LOWER(process.command_line) LIKE "* -eq *" OR TO_LOWER(process.command_line) LIKE "* -ne *" OR TO_LOWER(process.command_line) LIKE "* -match *" OR TO_LOWER(process.command_line) LIKE "* -like *" OR TO_LOWER(process.command_line) LIKE "* -contains *" OR TO_LOWER(process.command_line) LIKE "*.equals(*" OR TO_LOWER(process.command_line) LIKE "*if(*" OR TO_LOWER(process.command_line) LIKE "*if (*"))
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. --> <rule id="100000" level="7"> <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. --> <field name="CommandLine" type="pcre2">(?i)(env:COMPUTERNAME|env:USERDOMAIN|env:USERDNSDOMAIN|env:LOGONSERVER|Win32_ComputerSystem|Win32_ComputerSystemProduct|csproduct get uuid|computersystem get domain|GetHostByName|GetIPGlobalProperties|Get-ADDomain|DirectoryServices\.ActiveDirectory|NetworkInformation\.NetworkInterface)</field> <field name="CommandLine" type="pcre2">(?i)( -eq | -ne | -match | -like | -contains |\.Equals\(|if\(|if \()</field> <description>Environment-keyed conditional execution on the command line</description> <mitre> <id>T1480</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.