Detection rules › Splunk

Remote Thread Created by Uncommon Process (Sysmon)

Group by
_time, host
Source
github.com/anvilogic-forge/armory

Remote thread creation involves a process initiating a thread within the address space of another process. While this activity can occur during normal system operation, threat actors may abuse remote threads to attempt privilege escalation, defense evasion, or code injection. This use case detects remote threads created by LOLBINs that do not typically create remote threads. Some known benign combinations of source and target images have been filtered out to reduce noise. Sysmon event 8 logging is required for detection. LOLBINS/LOLBAS

MITRE ATT&CK coverage

TacticTechniques
Privilege Escalation
Stealth

References

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 8: CreateRemoteThread

Rule body

id: '22461.40120'
title: Remote Thread Created by Uncommon Process
description: Remote thread creation involves a process initiating a thread within
  the address space of another process. While this activity can occur during normal
  system operation, threat actors may abuse remote threads to attempt privilege escalation,
  defense evasion, or code injection. This use case detects remote threads created
  by LOLBINs that do not typically create remote threads. Some known benign combinations
  of source and target images have been filtered out to reduce noise. Sysmon event
  8 logging is required for detection. LOLBINS/LOLBAS
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_sysmon` (TERM(EventCode=8) OR "<EventID>8<")
  ("bash.exe" OR "cscript.exe" OR "cvtres.exe" OR "defrag.exe" OR "dnx.exe" OR "esentutl.exe"
  OR "excel.exe" OR "expand.exe" OR "explorer.exe" OR "find.exe" OR "findstr.exe"
  OR "forfiles.exe" OR "gpupdate.exe" OR "hh.exe" OR "iexplore.exe" OR "installutil.exe"
  OR "lync.exe" OR "makecab.exe" OR "mDNSResponder.exe" OR "monitoringhost.exe" OR
  "msbuild.exe" OR "mshta.exe" OR "msiexec.exe" OR "mspaint.exe" OR "outlook.exe"
  OR "ping.exe" OR "powerpnt.exe" OR "provtool.exe" OR "python.exe" OR "regsvr32.exe"
  OR "robocopy.exe" OR "runonce.exe" OR "sapcimc.exe" OR "schtasks.exe" OR "smartscreen.exe"
  OR "spoolsv.exe" OR "tstheme.exe" OR "userinit.exe" OR "vssadmin.exe" OR "vssvc.exe"
  OR "w3wp.exe" OR "winlogon.exe" OR "winscp.exe" OR "winword.exe" OR "wmic.exe" OR
  "wscript.exe") | rex field=SourceImage "\x5c(?<source_image>[^\x5c]+)$"| rex field=TargetImage
  "\x5c(?<target_image>[^\x5c]+)$"| regex source_image="(?i)(bash|cscript|cvtres|defrag|dnx|esentutl|excel|expand|explorer|find|findstr|forfiles|gpupdate|hh|iexplore|installutil|lync|makecab|mDNSResponder|monitoringhost|msbuild|mshta|msiexec|mspaint|outlook|ping|powerpnt|provtool|python|regsvr32|robocopy|runonce|sapcimc|schtasks|smartscreen|spoolsv|tstheme|userinit|vssadmin|vssvc|w3wp|winlogon|winscp|winword|wmic|wscript)\.exe"|
  where NOT ((match(source_image, "(?i)\x5cwinlogon\.exe") AND match(target_image,
  "(?i)\x5c(services|wininit|csrss)\.exe")) OR (match(source_image, "(?i)\x5cwinlogon\.exe")
  AND TargetParentImage="System" AND TargetParentProcessId=4) OR (match(source_image,
  "(?i)\x5cprovtool\.exe") AND TargetParentProcessId=0) OR (match(source_image, "(?i)\x5cVSSVC\.exe")
  AND match(target_image, "System")) OR (match(source_image, "(?i)\x5cschtasks\.exe")
  AND match(target_image, "(?i)\x5cconhost\.exe")) OR (match(source_image, "(?i)\x5cexplorer\.exe")
  AND match(target_image, "(?i)\x5cNVIDIA\sGeForce\sExperience\.exe"))) | table _time,
  host, user host, process, process_*, parent_process_*, source_image, target_image
  | bin span=1s | stats values(*) as * by _time, host '
techniques:
- defense-evasion:process injection
- privilege-escalation:process injection
technique_id: 
- T1055
data_category:
- Windows Sysmon
references:
- https://github.com/SigmaHQ/sigma/blob/62d4fd26b05f4d81973e7c8e80d7c1a0c6a29d0e/rules/windows/create_remote_thread/create_remote_thread_win_uncommon_source_image.yml
- https://lolbas-project.github.io

Stages and Predicates

Stage 1: search

`get_endpoint_data` `get_endpoint_data_sysmon` (TERM(EventCode=8) OR "<EventID>8<") ("bash.exe" OR "cscript.exe" OR "cvtres.exe" OR "defrag.exe" OR "dnx.exe" OR "esentutl.exe" OR "excel.exe" OR "expand.exe" OR "explorer.exe" OR "find.exe" OR "findstr.exe" OR "forfiles.exe" OR "gpupdate.exe" OR "hh.exe" OR "iexplore.exe" OR "installutil.exe" OR "lync.exe" OR "makecab.exe" OR "mDNSResponder.exe" OR "monitoringhost.exe" OR "msbuild.exe" OR "mshta.exe" OR "msiexec.exe" OR "mspaint.exe" OR "outlook.exe" OR "ping.exe" OR "powerpnt.exe" OR "provtool.exe" OR "python.exe" OR "regsvr32.exe" OR "robocopy.exe" OR "runonce.exe" OR "sapcimc.exe" OR "schtasks.exe" OR "smartscreen.exe" OR "spoolsv.exe" OR "tstheme.exe" OR "userinit.exe" OR "vssadmin.exe" OR "vssvc.exe" OR "w3wp.exe" OR "winlogon.exe" OR "winscp.exe" OR "winword.exe" OR "wmic.exe" OR "wscript.exe")

Stage 2: rex

| rex field=SourceImage "\x5c(?<source_image>[^\x5c]+)$"

The parser skipped this rex command.

Stage 3: rex

| rex field=TargetImage "\x5c(?<target_image>[^\x5c]+)$"

The parser skipped this rex command.

Stage 4: regex

| regex source_image="(?i)(bash|cscript|cvtres|defrag|dnx|esentutl|excel|expand|explorer|find|findstr|forfiles|gpupdate|hh|iexplore|installutil|lync|makecab|mDNSResponder|monitoringhost|msbuild|mshta|msiexec|mspaint|outlook|ping|powerpnt|provtool|python|regsvr32|robocopy|runonce|sapcimc|schtasks|smartscreen|spoolsv|tstheme|userinit|vssadmin|vssvc|w3wp|winlogon|winscp|winword|wmic|wscript)\.exe"

Stage 5: where

| where NOT ((match(source_image, "(?i)\x5cwinlogon\.exe") AND match(target_image, "(?i)\x5c(services|wininit|csrss)\.exe")) OR (match(source_image, "(?i)\x5cwinlogon\.exe") AND TargetParentImage="System" AND TargetParentProcessId=4) OR (match(source_image, "(?i)\x5cprovtool\.exe") AND TargetParentProcessId=0) OR (match(source_image, "(?i)\x5cVSSVC\.exe") AND match(target_image, "System")) OR (match(source_image, "(?i)\x5cschtasks\.exe") AND match(target_image, "(?i)\x5cconhost\.exe")) OR (match(source_image, "(?i)\x5cexplorer\.exe") AND match(target_image, "(?i)\x5cNVIDIA\sGeForce\sExperience\.exe")))

Stage 6: table

| table _time, host, user host, process, process_*, parent_process_*, source_image, target_image

Stage 7: bucket

| bin span=1s

Stage 8: stats

| stats values(*) as * by _time, host

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
TargetParentImageeq"System"excludes:TargetParentImage
TargetParentProcessIdeq4excludes:TargetParentProcessId field:"TargetParentProcessId" value:"4"
source_imageregex_match"(?i)\x5cwinlogon.exe"excludes:source_image
TargetParentProcessIdeq0excludes:TargetParentProcessId field:"TargetParentProcessId" value:"0"
source_imageregex_match"(?i)\x5cprovtool.exe"excludes:source_image
source_imageregex_match"(?i)\x5cVSSVC.exe"excludes:source_image
target_imageregex_match"System"excludes:target_image
source_imageregex_match"(?i)\x5cexplorer.exe"excludes:source_image
target_imageregex_match"(?i)\x5cNVIDIA\sGeForce\sExperience.exe"excludes:target_image
source_imageregex_match"(?i)\x5cschtasks.exe"excludes:source_image
target_imageregex_match"(?i)\x5cconhost.exe"excludes:target_image
target_imageregex_match"(?i)\x5c(services|wininit|csrss).exe"excludes:target_image

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
EventCodeeq
  • 8 corpus 10 (splunk 9, elastic 1)
field:"EventID" kind:eq value:"8"
source_imageregex_match
  • "(?i)(bash|cscript|cvtres|defrag|dnx|esentutl|excel|expand|explorer|find|findstr|forfiles|gpupdate|hh|iexplore|installutil|lync|makecab|mDNSResponder|monitoringhost|msbuild|mshta|msiexec|mspaint|outlook|ping|powerpnt|provtool|python|regsvr32|robocopy|runonce|sapcimc|schtasks|smartscreen|spoolsv|tstheme|userinit|vssadmin|vssvc|w3wp|winlogon|winscp|winword|wmic|wscript).exe"
field:"source_image" kind:regex_match

Search terms

These SPL tokens match against raw event text.

StageTerm
1"<EventID>8<"
1"bash.exe"
1"cscript.exe"
1"cvtres.exe"
1"defrag.exe"
1"dnx.exe"
1"esentutl.exe"
1"excel.exe"
1"expand.exe"
1"explorer.exe"
1"find.exe"
1"findstr.exe"
1"forfiles.exe"
1"gpupdate.exe"
1"hh.exe"
1"iexplore.exe"
1"installutil.exe"
1"lync.exe"
1"makecab.exe"
1"mDNSResponder.exe"
1"monitoringhost.exe"
1"msbuild.exe"
1"mshta.exe"
1"msiexec.exe"
1"mspaint.exe"
1"outlook.exe"
1"ping.exe"
1"powerpnt.exe"
1"provtool.exe"
1"python.exe"
1"regsvr32.exe"
1"robocopy.exe"
1"runonce.exe"
1"sapcimc.exe"
1"schtasks.exe"
1"smartscreen.exe"
1"spoolsv.exe"
1"tstheme.exe"
1"userinit.exe"
1"vssadmin.exe"
1"vssvc.exe"
1"w3wp.exe"
1"winlogon.exe"
1"winscp.exe"
1"winword.exe"
1"wmic.exe"
1"wscript.exe"