| ID | Technique | Tactic |
|---|---|---|
| T1021.006 | Windows Remote Management | Lateral Movement |
| T1059 | Command and Scripting Interpreter | Execution |
Detection: Windows Remote Management Execute Shell
Description
This analytic detects selected processes spawned directly by Windows Remote Management Host processes winrshost.exe and wsmprovhost.exe. The selected children include shells, scripting hosts, and administrative, discovery, and file-transfer utilities. This target-side process relationship can indicate remote execution, but it can also result from authorized WinRM administration. Investigate the account, target host, available command line, and surrounding remote-logon activity to determine context.
Search
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 IN (
9 "winrshost.exe",
10 "wsmprovhost.exe"
11)
12`windows_shells`
13NOT (
14 Processes.process_name="powershell.exe"
15 Processes.process="*-Version 5.1 -s -NoLogo -NoProfile"
16 )
17NOT (
18 Processes.process_name="cmd.exe"
19 (
20 (
21 Processes.process="*powershell -NoLogo -NonInteractive -NoProfile*"
22 Processes.process IN (
23 "*Get-CimInstance MSFT_NetAdapter -Namespace *",
24 "*Get-Command exsetup *",
25 "*Get-Disk
26| ForEach-Object*",
27 "*HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall*",
28 "*HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Class\\*",
29 "*HKLM:\\SYSTEM\\CurrentControlSet\\Services\\*",
30 "*New-Object Management.Automation.Host.Size*"
31 )
32 )
33 OR
34 Processes.process="* /c net start Veeam*"
35 )
36 )
37
38BY Processes.action Processes.dest Processes.original_file_name
39 Processes.parent_process Processes.parent_process_exec Processes.parent_process_guid
40 Processes.parent_process_id Processes.parent_process_name Processes.parent_process_path
41 Processes.process Processes.process_exec Processes.process_guid
42 Processes.process_hash Processes.process_id Processes.process_integrity_level
43 Processes.process_name Processes.process_path Processes.user
44 Processes.user_id Processes.vendor_product
45
46
47| `drop_dm_object_name(Processes)`
48
49| `security_content_ctime(firstTime)`
50
51| `security_content_ctime(lastTime)`
52
53| `windows_remote_management_execute_shell_filter`
Data Source
| Name | Platform | Sourcetype | Source |
|---|---|---|---|
| Sysmon EventID 1 | 'XmlWinEventLog' |
'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational' |
|
| Windows Event Log Security 4688 | 'XmlWinEventLog' |
'XmlWinEventLog:Security' |
Macros Used
| Name | Value |
|---|---|
| windows_shells | (Processes.process_name IN ("bash.exe", "cmd.exe", "powershell.exe", "powershell_ise.exe", "pwsh.exe", "sh.exe", "WindowsTerminal.exe", "wt.exe") OR Processes.original_file_name IN ("Cmd.Exe", "PowerShell.EXE", "pwsh.dll", "PowerShell_ISE.EXE")) |
| windows_remote_management_execute_shell_filter | search * |
windows_remote_management_execute_shell_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
CVE
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 Finding (Notable) | No |
| Creates Intermediate Finding (Risk Event) | Yes |
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
Authorized administrators and management software may launch these processes through WinRM. Shell and discovery activity may be routine; evaluate expected accounts, hosts, and workflows before tuning.
Associated Analytic Story
Intermediate Findings
| Message | Entity Field | Entity Type | Risk Score |
|---|---|---|---|
| Windows Remote Management process [$parent_process_name$] spawned [$process_name$] with CommandLine [$process$] on [$dest$]. | dest | system | 20 |
Threat Objects
| Field | Type |
|---|---|
| process | process |
| process_name | process_name |
References
-
https://strontic.github.io/xcyclopedia/library/wsmprovhost.exe-620CBF4C26A1E8871F1767C5F00F96E1.html
-
https://github.com/0vercl0k/CVE-2021-31166/blob/main/cve-2021-31166.py
-
https://strontic.github.io/xcyclopedia/library/winrshost.exe-6790044CEB4BA5BE6AA8161460D990FD.html
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: 9