Detection rules › Elastic

Potential Image Load via Transactional NTFS

Time window
1m
Sequence by
Target.process.entity_id, process.entity_id
Source
github.com/elastic/protections-artifacts

Identifies attempts to load a library from a potentially transacted file. This is a technique that exploits Transactional NTFS to execute arbitrary code in the address space of a separate running process, without committing the code to disk.

MITRE ATT&CK coverage

TacticTechniques
Stealth

Rule body

[rule]
description = """
Identifies attempts to load a library from a potentially transacted file. This is a technique that exploits
Transactional NTFS to execute arbitrary code in the address space of a separate running process, without committing the
code to disk.
"""
id = "edc23204-fd97-4c0f-8a2a-bb769370a7e3"
license = "Elastic License v2"
name = "Potential Image Load via Transactional NTFS"
os_list = ["windows"]
reference = ["https://www.elastic.co/blog/process-ghosting-a-new-executable-image-tampering-attack"]
version = "1.0.5"

query = '''
sequence with maxspan=1m
[library where event.action == "load" and process.pid != 4 and
  dll.Ext.defense_evasions : "Process Tampering: Image is writable" and
  dll.Ext.defense_evasions : "Process Tampering: Image has been accessed before mapping"] by process.entity_id as event0
[api where
  process.Ext.api.name in ("SetThreadContext", "Wow64SetThreadContext") and
  process.executable != null and process.Ext.api.behaviors == "cross-process" and
  stringcontains~(process.Ext.api.summary, event0.dll.name) and
  process.thread.Ext.call_stack_final_user_module.name != null and
  process.thread.Ext.call_stack_final_user_module.name != "Kernel"] by Target.process.entity_id
'''

min_endpoint_version = "8.12.0"
[[actions]]
action = "kill_process"
field = "Target.process.entity_id"
state = 0
tree = true

[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true

[[optional_actions]]
action = "rollback"
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.

Stage 1: library

[library where event.action == "load" and process.pid != 4 and
  dll.Ext.defense_evasions : "Process Tampering: Image is writable" and
  dll.Ext.defense_evasions : "Process Tampering: Image has been accessed before mapping"] by process.entity_id as event0

Stage 2: api

[api where
  process.Ext.api.name in ("SetThreadContext", "Wow64SetThreadContext") and
  process.executable != null and process.Ext.api.behaviors == "cross-process" and
  stringcontains~(process.Ext.api.summary, event0.dll.name) and
  process.thread.Ext.call_stack_final_user_module.name != null and
  process.thread.Ext.call_stack_final_user_module.name != "Kernel"] by Target.process.entity_id

Indicators

These rows show field, operator, and value matches.