Detection rules › Elastic

Library Loaded via a Worker Callback

Source
github.com/elastic/protections-artifacts

Identifies the load of a library indirectly via a callback function. This may be the result of an evasion attempt to hide the origin of the API call from the call stack such as unbacked memory region.

MITRE ATT&CK coverage

TacticTechniques
Stealth

Rule body

[rule]
description = """
Identifies the load of a library indirectly via a callback function. This may be the result of an evasion attempt to
hide the origin of the API call from the call stack such as unbacked memory region.
"""
id = "b2beb283-0a5c-4a7c-bd97-54b920392897"
license = "Elastic License v2"
name = "Library Loaded via a Worker Callback"
os_list = ["windows"]
reference = [
    "https://www.elastic.co/security-labs/doubling-down-etw-callstacks",
    "https://0xdarkvortex.dev/hiding-in-plainsight/",
]
version = "1.0.4"

query = '''
library where dll.name : ("ws2_32.dll", "winhttp.dll", "wininet.dll") and process.name != null and
 process.thread.Ext.call_stack_summary like "ntdll.dll|kernelbase.dll|*|ntdll.dll|kernel32.dll|ntdll.dll" and
 not process.thread.Ext.call_stack_summary like "ntdll.dll|kernelbase.dll|*|*|ntdll.dll|kernel32.dll|ntdll.dll" and
 not stringcontains~(process.thread.Ext.call_stack_summary, process.name) and
 not (user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
      process.executable : ("C:\\Windows\\System32\\svchost.exe",
                            "C:\\Windows\\System32\\lsass.exe",
                            "C:\\Windows\\System32\\LogonUI.exe")) and
 not process.thread.Ext.call_stack_summary in ("ntdll.dll|kernelbase.dll|smartcardcredentialprovider.dll|ntdll.dll|kernel32.dll|ntdll.dll",
                                               "ntdll.dll|kernelbase.dll|hostshellextension.dll|ntdll.dll|kernel32.dll|ntdll.dll",
                                               "ntdll.dll|kernelbase.dll|wsmsvc.dll|ntdll.dll|kernel32.dll|ntdll.dll",
                                               "ntdll.dll|kernelbase.dll|ws2_32.dll|ntdll.dll|kernel32.dll|ntdll.dll",
                                               "ntdll.dll|kernelbase.dll|das.dll|ntdll.dll|kernel32.dll|ntdll.dll",
                                               "ntdll.dll|kernelbase.dll|lucanet.dll|ntdll.dll|kernel32.dll|ntdll.dll") and
 not (process.code_signature.trusted == true and process.code_signature.subject_name : ("SentinelOne Inc.", "Sentinelone, Inc.", "Sentinel Labs, Inc.", "Bitglass, LLC", "Adobe Inc.")) and
 not (process.code_signature.trusted == true and process.code_signature.subject_name == "LucaNet AG" and process.executable : "C:\\Program Files\\LucaNet\\Youniverse\\.bin\\LucaNet.exe") and
 _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info : ("*ntdll.dll!TppWorkpExecuteCallback*", "*ntdll.dll!TppWorkerThread*", "*ntdll.dll!RtlClearThreadWorkOnBehalfTicket*"))
'''

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

[[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.10.0"

Stages and Predicates

Stage 1: library

library where dll.name : ("ws2_32.dll", "winhttp.dll", "wininet.dll") and process.name != null and
 process.thread.Ext.call_stack_summary like "ntdll.dll|kernelbase.dll|*|ntdll.dll|kernel32.dll|ntdll.dll" and
 not process.thread.Ext.call_stack_summary like "ntdll.dll|kernelbase.dll|*|*|ntdll.dll|kernel32.dll|ntdll.dll" and
 not stringcontains~(process.thread.Ext.call_stack_summary, process.name) and
 not (user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
      process.executable : ("C:\\Windows\\System32\\svchost.exe",
                            "C:\\Windows\\System32\\lsass.exe",
                            "C:\\Windows\\System32\\LogonUI.exe")) and
 not process.thread.Ext.call_stack_summary in ("ntdll.dll|kernelbase.dll|smartcardcredentialprovider.dll|ntdll.dll|kernel32.dll|ntdll.dll",
                                               "ntdll.dll|kernelbase.dll|hostshellextension.dll|ntdll.dll|kernel32.dll|ntdll.dll",
                                               "ntdll.dll|kernelbase.dll|wsmsvc.dll|ntdll.dll|kernel32.dll|ntdll.dll",
                                               "ntdll.dll|kernelbase.dll|ws2_32.dll|ntdll.dll|kernel32.dll|ntdll.dll",
                                               "ntdll.dll|kernelbase.dll|das.dll|ntdll.dll|kernel32.dll|ntdll.dll",
                                               "ntdll.dll|kernelbase.dll|lucanet.dll|ntdll.dll|kernel32.dll|ntdll.dll") and
 not (process.code_signature.trusted == true and process.code_signature.subject_name : ("SentinelOne Inc.", "Sentinelone, Inc.", "Sentinel Labs, Inc.", "Bitglass, LLC", "Adobe Inc.")) and
 not (process.code_signature.trusted == true and process.code_signature.subject_name == "LucaNet AG" and process.executable : "C:\\Program Files\\LucaNet\\Youniverse\\.bin\\LucaNet.exe") and
 _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info : ("*ntdll.dll!TppWorkpExecuteCallback*", "*ntdll.dll!TppWorkerThread*", "*ntdll.dll!RtlClearThreadWorkOnBehalfTicket*"))

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.subject_nameeqLucaNet AGexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"LucaNet AG"
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.executableeqC:\Program Files\LucaNet\Youniverse\.bin\LucaNet.exeexcludes:process.executable field:"process.executable" value:"C:\Program Files\LucaNet\Youniverse\.bin\LucaNet.exe"
process.code_signature.subject_nameeqSentinelOne Inc., Sentinelone, Inc., Sentinel Labs, Inc., Bitglass, LLC, Adobe Inc.excludes:process.code_signature.subject_name
process.executableeqC:\Windows\System32\svchost.exe, C:\Windows\System32\lsass.exe, C:\Windows\System32\LogonUI.exeexcludes:process.executable field:"process.executable" value:"C:\Windows\System32\svchost.exe" field:"process.executable" value:"C:\Windows\System32\lsass.exe" field:"process.executable" value:"C:\Windows\System32\LogonUI.exe"
user.idinS-1-5-18, S-1-5-19, S-1-5-20excludes:user.id field:"user.id" value:"S-1-5-18" field:"user.id" value:"S-1-5-19" field:"user.id" value:"S-1-5-20"
process.thread.Ext.call_stack_summarycontainsprocess.nameexcludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"process.name"
process.thread.Ext.call_stack_summaryinntdll.dll|kernelbase.dll|das.dll|ntdll.dll|kernel32.dll|ntdll.dll, ntdll.dll|kernelbase.dll|hostshellextension.dll|ntdll.dll|kernel32.dll|ntdll.dll, ntdll.dll|kernelbase.dll|lucanet.dll|ntdll.dll|kernel32.dll|ntdll.dll, ntdll.dll|kernelbase.dll|smartcardcredentialprovider.dll|ntdll.dll|kernel32.dll|ntdll.dll, ntdll.dll|kernelbase.dll|ws2_32.dll|ntdll.dll|kernel32.dll|ntdll.dll, ntdll.dll|kernelbase.dll|wsmsvc.dll|ntdll.dll|kernel32.dll|ntdll.dllexcludes:process.thread.Ext.call_stack_summary
process.thread.Ext.call_stack_summarywildcardntdll.dll|kernelbase.dll|*|*|ntdll.dll|kernel32.dll|ntdll.dllexcludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"ntdll.dll|kernelbase.dll|*|*|ntdll.dll|kernel32.dll|ntdll.dll"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dll.namewildcard
  • winhttp.dll corpus 16 (elastic 16)
  • wininet.dll corpus 18 (elastic 18)
  • ws2_32.dll corpus 20 (elastic 20)
field:"dll.name" kind:wildcard
process.nameis_not_null
  • (no value, null check)
field:"process_name" kind:is_not_null
process.thread.Ext.call_stack_summarywildcard
  • ntdll.dll|kernelbase.dll|*|ntdll.dll|kernel32.dll|ntdll.dll
field:"process.thread.Ext.call_stack_summary" kind:wildcard value:"ntdll.dll|kernelbase.dll|*|ntdll.dll|kernel32.dll|ntdll.dll"