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.
Query · spl
`sysmon`
EventCode=8
SourceImage IN (
"*\\powershell_ise.exe",
"*\\powershell.exe",
"*\\pwsh.exe"
)
TargetImage IN (
"*\\csrss.exe",
"*\\explorer.exe",
"*\\gpupdate.exe",
"*\\services.exe",
"*\\smss.exe",
"*\\spoolsv.exe",
"*\\svchost.exe",
"*\\taskhost.exe",
"*\\userinit.exe",
"*\\wininit.exe",
"*\\winlogon.exe"
)
| stats count min(_time) as firstTime
max(_time) as lastTime
values(NewThreadId) as "NewThreadId"
values(StartAddress) as "StartAddress"
by dest signature_id signature
SourceProcessGuid SourceProcessId SourceImage
TargetProcessGuid TargetProcessId TargetImage
StartModule StartFunction vendor_product
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `powershell_remote_thread_to_known_windows_process_filter`
Implementation guide
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.
Analyst notes
Known false positives: No false positives have been identified at this time.