Detection rules › Elastic

Potential Code Injection via Remote Thread

Source
github.com/elastic/protections-artifacts

Identifies the creation of a thread in a remote process, this type of behavior may indicate inter-process code injection. Adversaries may inject code into processes in order to evade process-based defenses as well as possibly elevate privileges.

MITRE ATT&CK coverage

TacticTechniques
Privilege Escalation

Rule body

[rule]
description = """
Identifies the creation of a thread in a remote process, this type of behavior may indicate inter-process code
injection. Adversaries may inject code into processes in order to evade process-based defenses as well as possibly
elevate privileges.
"""
id = "458f0b4b-be9a-45bc-8f19-a26dac267250"
license = "Elastic License v2"
name = "Potential Code Injection via Remote Thread"
os_list = ["macos"]
reference = ["http://newosxbook.com/src.jl?tree=listings&file=inject.c"]
version = "1.0.31"

query = '''
process where event.action == "remote_thread" and
 not process.executable like
          ("/usr/libexec/rosetta/debugserver",
           "/Library/Developer/CoreSimulator/*/RemoteInjectionAgent",
           "/Applications/Xcode*.app/Contents/SharedFrameworks/DVTInstrumentsFoundation.framework/Versions/A/Resources/RemoteInjectionAgent")
'''

min_endpoint_version = "8.7.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"


[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"

[internal]
min_endpoint_version = "8.7.0"

Stages and Predicates

Stage 1: process

process where event.action == "remote_thread" and
 not process.executable like
          ("/usr/libexec/rosetta/debugserver",
           "/Library/Developer/CoreSimulator/*/RemoteInjectionAgent",
           "/Applications/Xcode*.app/Contents/SharedFrameworks/DVTInstrumentsFoundation.framework/Versions/A/Resources/RemoteInjectionAgent")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.executablewildcard/usr/libexec/rosetta/debugserver, /Library/Developer/CoreSimulator/*/RemoteInjectionAgent, /Applications/Xcode*.app/Contents/SharedFrameworks/DVTInstrumentsFoundation.framework/Versions/A/Resources/RemoteInjectionAgentexcludes:process.executable field:"process.executable" value:"/usr/libexec/rosetta/debugserver" field:"process.executable" value:"/Library/Developer/CoreSimulator/*/RemoteInjectionAgent" field:"process.executable" value:"/Applications/Xcode*.app/Contents/SharedFrameworks/DVTInstrumentsFoundation.framework/Versions/A/Resources/RemoteInjectionAgent"

Indicators

These rows show field, operator, and value matches.