Detection rules › Elastic

Suspicious Image Load from SMB Shares

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

Identifies the load of a DLL from a network file share followed by a suspicious DLL load event. Adversaries may leverage this technique to avoid dropping to disk the malicious payload on the targeted machine.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the load of a DLL from a network file share followed by a suspicious DLL load event. Adversaries may leverage
this technique to avoid dropping to disk the malicious payload on the targeted machine.
"""
id = "c9674e88-8423-442a-9712-ba6271bcff10"
license = "Elastic License v2"
name = "Suspicious Image Load from SMB Shares"
os_list = ["windows"]
version = "1.0.23"

query = '''
sequence by process.entity_id with maxspan=1m
 [library where dll.path : "\\Device\\Mup\\*" and not startswith~(dll.name, process.name) and 
  not _arraysearch(process.thread.Ext.call_stack, $entry,
                   $entry.symbol_info : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*", "?:\\Windows\\Sys*\\tmumh\\*\\tmmon.dll+*")) and
  not process.executable :
            ("?:\\Windows\\System32\\sdiagnhost.exe",
             "?:\\Windows\\System32\\CompPkgSrv.exe",
             "?:\\Windows\\System32\\backgroundTaskHost.exe") and 
  not process.thread.Ext.call_stack_summary : "ntdll.dll|kernelbase.dll|jvm.dll|java.dll|Unbacked"
  ]
 [library where
  process.executable != null and
  (
   (dll.name : ("ws2_32.dll", "wininet.dll", "psapi.dll") and
    process.thread.Ext.call_stack_summary == "ntdll.dll|kernelbase.dll|Unbacked") or

   dll.name : ("dsquery.dll", "System.Management.Automation.dll")
  ) and 
  not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*")) and
  not (dll.name : "ws2_32.dll" and process.executable : "\\Device\\Mup\\*.edu\\*\\IDTest.exe") and 
  not (dll.name : "wininet.dll" and process.executable : "\\Device\\Mup\\nf01\\Application\\*.exe") and 
  not (process.name : "UiPath.ActivityCompiler.CommandLine.exe" and process.code_signature.subject_name : "UiPath, Inc." and 
       process.code_signature.trusted == true and dll.name : "System.Management.Automation.dll") and 
       
  not _arraysearch(process.thread.Ext.call_stack, $entry,
                   $entry.callsite_leading_bytes :
                         ("ffeb1e8d4e0ce86482000083660400684c5*",
                          "8bcee8ac9affff837d10007414ff7510*",
                          "0000004d63db4a8b0c19488b0948894d9890488b4db84533db488b458048898558ffffff488d051500000048898570ffffff488b4588c6400c00488b4598ffd0",
                          "8b750cc706d3c6ca05e8cd9d2e588b4d10e855d728588b4d108b750cc706dec6ca05e884102d588b4d10e8dcf72c588b4d108b750cc706e6c6ca05e89b9d2e58",
                          "008bc3eb8933c0413bed75824488afe81c0000e976ffffffcccccc40534881eca000000033db48391d66360d000f85bb010000488d0db9580b00ff15132b0900"))
  ]
'''

min_endpoint_version = "8.8.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1

[[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/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"
[[threat.technique.subtechnique]]
id = "T1021.002"
name = "SMB/Windows Admin Shares"
reference = "https://attack.mitre.org/techniques/T1021/002/"



[threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"

[internal]
min_endpoint_version = "8.8.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id.

Stage 1: library

[library where dll.path : "\\Device\\Mup\\*" and not startswith~(dll.name, process.name) and 
  not _arraysearch(process.thread.Ext.call_stack, $entry,
                   $entry.symbol_info : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*", "?:\\Windows\\Sys*\\tmumh\\*\\tmmon.dll+*")) and
  not process.executable :
            ("?:\\Windows\\System32\\sdiagnhost.exe",
             "?:\\Windows\\System32\\CompPkgSrv.exe",
             "?:\\Windows\\System32\\backgroundTaskHost.exe") and 
  not process.thread.Ext.call_stack_summary : "ntdll.dll|kernelbase.dll|jvm.dll|java.dll|Unbacked"
  ]

Stage 2: library

[library where
  process.executable != null and
  (
   (dll.name : ("ws2_32.dll", "wininet.dll", "psapi.dll") and
    process.thread.Ext.call_stack_summary == "ntdll.dll|kernelbase.dll|Unbacked") or

   dll.name : ("dsquery.dll", "System.Management.Automation.dll")
  ) and 
  not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*")) and
  not (dll.name : "ws2_32.dll" and process.executable : "\\Device\\Mup\\*.edu\\*\\IDTest.exe") and 
  not (dll.name : "wininet.dll" and process.executable : "\\Device\\Mup\\nf01\\Application\\*.exe") and 
  not (process.name : "UiPath.ActivityCompiler.CommandLine.exe" and process.code_signature.subject_name : "UiPath, Inc." and 
       process.code_signature.trusted == true and dll.name : "System.Management.Automation.dll") and 
       
  not _arraysearch(process.thread.Ext.call_stack, $entry,
                   $entry.callsite_leading_bytes :
                         ("ffeb1e8d4e0ce86482000083660400684c5*",
                          "8bcee8ac9affff837d10007414ff7510*",
                          "0000004d63db4a8b0c19488b0948894d9890488b4db84533db488b458048898558ffffff488d051500000048898570ffffff488b4588c6400c00488b4598ffd0",
                          "8b750cc706d3c6ca05e8cd9d2e588b4d10e855d728588b4d108b750cc706dec6ca05e884102d588b4d10e8dcf72c588b4d108b750cc706e6c6ca05e89b9d2e58",
                          "008bc3eb8933c0413bed75824488afe81c0000e976ffffffcccccc40534881eca000000033db48391d66360d000f85bb010000488d0db9580b00ff15132b0900"))
  ]

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.thread.Ext.call_stackarray_any(no value, null check)excludes:process.thread.Ext.call_stack
dll.namestarts_withprocess.nameexcludes:dll.name field:"dll.name" value:"process.name"
process.executableeq?:\Windows\System32\sdiagnhost.exe, ?:\Windows\System32\CompPkgSrv.exe, ?:\Windows\System32\backgroundTaskHost.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\sdiagnhost.exe" field:"process.executable" value:"?:\Windows\System32\CompPkgSrv.exe" field:"process.executable" value:"?:\Windows\System32\backgroundTaskHost.exe"
process.thread.Ext.call_stack_summaryeqntdll.dll|kernelbase.dll|jvm.dll|java.dll|Unbackedexcludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"ntdll.dll|kernelbase.dll|jvm.dll|java.dll|Unbacked"
dll.nameeqSystem.Management.Automation.dllexcludes:dll.name field:"dll.name" value:"System.Management.Automation.dll"
process.code_signature.subject_nameeqUiPath, Inc.excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"UiPath, Inc."
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.nameeqUiPath.ActivityCompiler.CommandLine.exeexcludes:process.name field:"process.name" value:"UiPath.ActivityCompiler.CommandLine.exe"
dll.nameeqwininet.dllexcludes:dll.name field:"dll.name" value:"wininet.dll"
process.executablewildcard\Device\Mup\nf01\Application\*.exeexcludes:process.executable field:"process.executable" value:"\Device\Mup\nf01\Application\*.exe"
dll.nameeqws2_32.dllexcludes:dll.name field:"dll.name" value:"ws2_32.dll"
process.executablewildcard\Device\Mup\*.edu\*\IDTest.exeexcludes:process.executable field:"process.executable" value:"\Device\Mup\*.edu\*\IDTest.exe"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dll.namewildcard
  • System.Management.Automation.dll corpus 5 (elastic 5)
  • dsquery.dll corpus 4 (elastic 4)
  • psapi.dll corpus 7 (elastic 7)
  • wininet.dll corpus 18 (elastic 18)
  • ws2_32.dll corpus 20 (elastic 20)
field:"dll.name" kind:wildcard
dll.pathwildcard
  • \Device\Mup\* corpus 5 (elastic 5)
field:"ImageLoaded" kind:wildcard value:"\Device\Mup\*"
process.executableis_not_null
  • (no value, null check)
field:"Image" kind:is_not_null
process.thread.Ext.call_stack_summaryeq
  • ntdll.dll|kernelbase.dll|Unbacked corpus 3 (elastic 3)
field:"process.thread.Ext.call_stack_summary" kind:eq value:"ntdll.dll|kernelbase.dll|Unbacked"