Detection: Windows MSIExec Spawn Discovery Command

Description

The following analytic detects MSIExec spawning multiple discovery commands. This behavior is identified using data from Endpoint Detection and Response (EDR) agents, focusing on process creation events where MSIExec is the parent process. If confirmed malicious, an attacker could use these discovery commands to gather system information, potentially leading to further exploitation or lateral movement within the network.

  1
  2| tstats `security_content_summariesonly`
  3  count min(_time) as firstTime
  4        max(_time) as lastTime
  5
  6FROM datamodel=Endpoint.Processes WHERE
  7
  8Processes.parent_process_name=msiexec.exe
  9
 10(
 11    Processes.process_name IN (
 12        "arp.exe"
 13        "dsget.exe",
 14        "hostname.exe",
 15        "ipconfig.exe",
 16        "nbtstat.exe",
 17        "netdom.exe",
 18        "nltest.exe",
 19        "ntdsutil.exe",
 20        "qprocess.exe",
 21        "qwinsta.exe",
 22        "systeminfo.exe"
 23        "wmic.exe"
 24    )
 25    OR
 26    (
 27        Processes.process_name IN (
 28            "bash.exe",
 29            "cmd.exe",
 30            "powershell.exe",
 31            "powershell_ise.exe",
 32            "pwsh.exe"
 33        )
 34
 35        (
 36            Processes.process IN (
 37                "*arp *",
 38                "*dsget*",
 39                "*hostname*",
 40                "*ipconfig*",
 41                "*nbtstat*",
 42                "*netdom*",
 43                "*nltest*",
 44                "*ntdsutil*",
 45                "*qprocess *",
 46                "*qwinsta*",
 47                "*systeminfo*",
 48                "*wmic *"
 49            )
 50            OR
 51            (
 52                (
 53                    Processes.process IN (
 54                        "*net *",
 55                        "*net.exe *",
 56                        "*net1*"
 57                        "*net1.exe*"
 58                    )
 59                    OR
 60                    Processes.process_name IN (
 61                        "net.exe",
 62                        "net1.exe"
 63                    )
 64                )
 65                Processes.process = "*view*"
 66            )
 67            OR
 68            (
 69                (
 70                    Processes.process IN (
 71                        "*reg *",
 72                        "*reg.exe *"
 73                        "*sc *",
 74                        "*sc.exe *",
 75                    )
 76                    OR
 77                    Processes.process_name IN (
 78                        "reg.exe",
 79                        "sc.exe"
 80                    )
 81                )
 82                Processes.process = "*query*"
 83                NOT Processes.process = "* /SC *"
 84            )
 85            OR
 86            (
 87                (
 88                    Processes.process IN (
 89                        "*query *",
 90                        "*query.exe*"
 91                    )
 92                    OR
 93                    Processes.process_name = "query.exe"
 94                )
 95                Processes.process IN (
 96                    "* process",
 97                    "* session",
 98                    "* user",
 99                )
100            )
101        )
102    )
103)
104BY Processes.action Processes.dest Processes.original_file_name
105   Processes.parent_process Processes.parent_process_exec
106   Processes.parent_process_guid Processes.parent_process_id
107   Processes.parent_process_name Processes.parent_process_path
108   Processes.process Processes.process_exec Processes.process_guid
109   Processes.process_hash Processes.process_id Processes.process_integrity_level
110   Processes.process_name Processes.process_path Processes.user
111   Processes.user_id Processes.vendor_product
112
113
114| `drop_dm_object_name(Processes)`
115
116| `security_content_ctime(firstTime)`
117
118| `security_content_ctime(lastTime)`
119
120| `windows_msiexec_spawn_discovery_command_filter`

Data Source

Name Platform Sourcetype Source
CrowdStrike ProcessRollup2 Other 'crowdstrike:events:sensor' 'crowdstrike'
Sysmon EventID 1 Windows icon Windows 'XmlWinEventLog' 'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational'
Windows Event Log Security 4688 Windows icon Windows 'XmlWinEventLog' 'XmlWinEventLog:Security'

Macros Used

Name Value
security_content_ctime convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$)
windows_msiexec_spawn_discovery_command_filter search *
windows_msiexec_spawn_discovery_command_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1218.007 Msiexec Stealth
Exploitation
DE.AE
CIS 10

Default Configuration

This detection is configured by default in Splunk Enterprise Security to run with the following settings:

Setting Value
Disabled true
Cron Schedule 0 * * * *
Earliest Time -70m@m
Latest Time -10m@m
Schedule Window auto
Creates Risk Event True
This configuration file applies to all detections of type anomaly. These detections will use Risk Based Alerting.

Implementation

The detection is based on data that originates from Endpoint Detection and Response (EDR) agents. These agents are designed to provide security-related telemetry from the endpoints where the agent is installed. To implement this search, you must ingest logs that contain the process GUID, process name, and parent process. Additionally, you must ingest complete command-line executions. These logs must be processed using the appropriate Splunk Technology Add-ons that are specific to the EDR product. The logs must also be mapped to the Processes node of the Endpoint data model. Use the Splunk Common Information Model (CIM) to normalize the field names and speed up the data modeling process.

Known False Positives

False positives might still be present, depending on the installer. Filter as needed.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message:

An instance of $parent_process_name$ spawning $process_name$ was identified on endpoint $dest$ by user $user$ running different discovery commands.

Risk Object Risk Object Type Risk Score Threat Objects
dest system 30 process_name, parent_process_name
user user 30 process_name, parent_process_name

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation Passing N/A N/A N/A
Unit Passing Dataset XmlWinEventLog:Microsoft-Windows-Sysmon/Operational XmlWinEventLog
Integration ✅ Passing Dataset XmlWinEventLog:Microsoft-Windows-Sysmon/Operational XmlWinEventLog

Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI. Alternatively you can replay a dataset into a Splunk Attack Range


Source: GitHub | Version: 15