Detection: Powershell Remote Thread To Known Windows Process

Description

The following analytic detects suspicious PowerShell processes attempting to inject code into critical Windows processes using CreateRemoteThread. It leverages Sysmon EventCode 8 to identify instances where PowerShell spawns threads in processes like svchost.exe, csrss.exe, and others. This activity is significant as it is commonly used by malware such as TrickBot and offensive tools like Cobalt Strike to execute malicious payloads, establish reverse shells, or download additional malware. If confirmed malicious, this behavior could lead to unauthorized code execution, privilege escalation, and persistent access within the environment.

 1`sysmon`
 2EventCode=8
 3SourceImage IN (
 4    "*\\powershell_ise.exe",
 5    "*\\powershell.exe",
 6    "*\\pwsh.exe"
 7)
 8TargetImage IN (
 9    "*\\csrss.exe",
10    "*\\explorer.exe",
11    "*\\gpupdate.exe",
12    "*\\services.exe",
13    "*\\smss.exe",
14    "*\\spoolsv.exe",
15    "*\\svchost.exe",
16    "*\\taskhost.exe",
17    "*\\userinit.exe",
18    "*\\wininit.exe",
19    "*\\winlogon.exe"
20)
21
22| stats count min(_time) as firstTime
23              max(_time) as lastTime
24              values(NewThreadId) as "NewThreadId"
25              values(StartAddress) as "StartAddress"
26  by dest signature_id signature
27     SourceProcessGuid SourceProcessId SourceImage
28     TargetProcessGuid TargetProcessId TargetImage
29     StartModule StartFunction vendor_product
30
31| `security_content_ctime(firstTime)`
32
33| `security_content_ctime(lastTime)`
34
35| `powershell_remote_thread_to_known_windows_process_filter`

Data Source

Name Platform Sourcetype Source
Sysmon EventID 8 Windows icon Windows 'XmlWinEventLog' 'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational'

Macros Used

Name Value
sysmon (source=WinEventLog:Microsoft-Windows-Sysmon/Operational OR source=XmlWinEventLog:Microsoft-Windows-Sysmon/Operational OR source=Syslog:Linux-Sysmon/Operational)
powershell_remote_thread_to_known_windows_process_filter search *
powershell_remote_thread_to_known_windows_process_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
T1055 Process Injection Privilege Escalation
Exploitation
DE.CM
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 Finding (Notable) Yes
Rule Title %name%
Rule Description %description%
Notable Event Fields user, dest
Creates Intermediate Finding (Risk Event) No
TTP detections generate a Finding (Notable) and may generate Intermediate Findings (Risk Events) for associated entities.

Implementation

To successfully implement this search, you need to be ingesting logs with the process name, Create Remote thread from your endpoints. If you are using Sysmon, you must have at least version 6.0.4 of the Sysmon TA. Tune and filter known instances of create remote thread may be used.

Known False Positives

No false positives have been identified at this time.

Associated Analytic Story

Finding

Title Entity Field Entity Type Risk Score
A suspicious powershell process $SourceImage$ created a remote thread into the target process $TargetImage$ on host $dest$ dest system 50

Threat Objects

Field Type
SourceImage process_name
TargetImage 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: 12