Detection rules › Elastic
Early Remote Memory Allocation
Identifies attempts to allocate remote memory into a target process early before the start of its initial thread, this behavior is often associated with remote process injection preparation.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule body
[rule]
description = """
Identifies attempts to allocate remote memory into a target process early before the start of its initial thread, this
behavior is often associated with remote process injection preparation.
"""
id = "d0ffac28-7e18-416e-b9f6-d16cc8cdeeb4"
license = "Elastic License v2"
name = "Early Remote Memory Allocation"
os_list = ["windows"]
reference = ["https://www.elastic.co/security-labs/doubling-down-etw-callstacks"]
version = "1.0.2"
query = '''
sequence with maxspan=1m
[api where process.Ext.api.behaviors == "cross-process" and process.Ext.api.behaviors =="parent-child" and
process.Ext.api.name in ("VirtualAllocEx", "MapViewOfFile", "MapViewOfFile2") and
Target.process.Ext.token.integrity_level_name != "low" and process.thread.Ext.call_stack_summary != null and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true) and
not process.thread.Ext.call_stack_final_user_module.name in ("Kernel", "Unknown", "Undetermined") and
not process.thread.Ext.call_stack_final_user_module.path like ("?:\\program files\\*", "?:\\program files (x86)\\*") and
process.thread.Ext.call_stack_final_user_module.protection_provenance != "Kernel" and
process.thread.Ext.call_stack_final_user_module.hash.sha256 != "0ebf9d054ab20f8ce5ac2cd5f66244af4289faaac743bd616809d08cec78d6c2"] by process.entity_id, Target.process.entity_id
[process where event.action == "start"] by process.parent.entity_id, process.entity_id
'''
min_endpoint_version = "8.12.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "Target.process.entity_id"
state = 0
[[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 = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.12.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by Target.process.entity_id, process.entity_id, process.parent.entity_id.
Stage 1: api
[api where process.Ext.api.behaviors == "cross-process" and process.Ext.api.behaviors =="parent-child" and
process.Ext.api.name in ("VirtualAllocEx", "MapViewOfFile", "MapViewOfFile2") and
Target.process.Ext.token.integrity_level_name != "low" and process.thread.Ext.call_stack_summary != null and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true) and
not process.thread.Ext.call_stack_final_user_module.name in ("Kernel", "Unknown", "Undetermined") and
not process.thread.Ext.call_stack_final_user_module.path like ("?:\\program files\\*", "?:\\program files (x86)\\*") and
process.thread.Ext.call_stack_final_user_module.protection_provenance != "Kernel" and
process.thread.Ext.call_stack_final_user_module.hash.sha256 != "0ebf9d054ab20f8ce5ac2cd5f66244af4289faaac743bd616809d08cec78d6c2"] by process.entity_id, Target.process.entity_id
Stage 2: process
[process where event.action == "start"] by process.parent.entity_id, process.entity_id
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.thread.Ext.call_stack_final_user_module.code_signature | array_any | excludes:process.thread.Ext.call_stack_final_user_module.code_signature | |
process.thread.Ext.call_stack_final_user_module.name | in | Kernel, Undetermined, Unknown | excludes:process.thread.Ext.call_stack_final_user_module.name field:"process.thread.Ext.call_stack_final_user_module.name" value:"Kernel" field:"process.thread.Ext.call_stack_final_user_module.name" value:"Undetermined" field:"process.thread.Ext.call_stack_final_user_module.name" value:"Unknown" |
process.thread.Ext.call_stack_final_user_module.path | starts_with | ?:\program files\, ?:\program files (x86)\ | excludes:process.thread.Ext.call_stack_final_user_module.path field:"process.thread.Ext.call_stack_final_user_module.path" value:"?:\program files\" field:"process.thread.Ext.call_stack_final_user_module.path" value:"?:\program files (x86)\" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Target.process.Ext.token.integrity_level_name | ne |
| field:"Target.process.Ext.token.integrity_level_name" kind:ne value:"low" |
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.Ext.api.behaviors | eq |
| field:"process.Ext.api.behaviors" kind:eq |
process.Ext.api.name | in |
| field:"process.Ext.api.name" kind:in |
process.thread.Ext.call_stack_final_user_module.hash.sha256 | ne |
| field:"process.thread.Ext.call_stack_final_user_module.hash.sha256" kind:ne value:"0ebf9d054ab20f8ce5ac2cd5f66244af4289faaac743bd616809d08cec78d6c2" |
process.thread.Ext.call_stack_final_user_module.protection_provenance | ne |
| field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" kind:ne value:"Kernel" |
process.thread.Ext.call_stack_summary | is_not_null | field:"process.thread.Ext.call_stack_summary" kind:is_not_null |