Detection rules › Elastic

Suspicious Unsigned DLL Loaded by a Trusted Process

Time window
5s
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

Identifies the load of an unsigned or untrusted DLL by a trusted binary followed by loading a networking DLL from unbacked memory region. This may indicate execution via DLL sideloading.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the load of an unsigned or untrusted DLL by a trusted binary followed by loading a networking DLL from
unbacked memory region. This may indicate execution via DLL sideloading.
"""
id = "14fbbd38-b858-45fa-8bc5-02a7bfd295e6"
license = "Elastic License v2"
name = "Suspicious Unsigned DLL Loaded by a Trusted Process"
os_list = ["windows"]
reference = [
    "https://www.elastic.co/security-labs/upping-the-ante-detecting-in-memory-threats-with-kernel-call-stacks",
]
version = "1.0.21"

query = '''
sequence by process.entity_id with maxspan=5s
[library where
   (dll.Ext.relative_file_creation_time < 5000 or
    dll.Ext.relative_file_name_modify_time < 5000 or
    (dll.Ext.device.product_id : ("Virtual DVD-ROM", "Virtual Disk","USB *") and not dll.path : "C:\\*")) and
    process.code_signature.trusted == true and
    not dll.code_signature.status : ("trusted", "errorExpired", "errorCode_endpoint*") and
    dll.hash.sha256 != null and 
    not dll.hash.sha256 in ("e99fec7f1f2fe16029b4dbe30a96325efd7265c9cc8672f60945ce943684442d", "a654a64f0fbd2c34fc2b22cb41e2bf4ac32bd15ae6620e6a4198beb5270790f6") and
    (process.thread.Ext.call_stack_summary : "ntdll.dll*" and not process.thread.Ext.call_stack_summary : "*Unbacked*") and
    not dll.path : ("?:\\Windows\\Installer\\*",
                   "?:\\Windows\\System32\\DriverStore\\FileRepository\\*",
                   "?:\\Windows\\SysWOW64\\DriverStore\\FileRepository\\*",
                   "?:\\Program Files\\*",
                   "?:\\Program Files (x86)\\*",
                   "?:\\Windows\\assembly\\*") and
   not process.executable :
             ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe", "?:\\Windows\\Explorer.exe",
              "?:\\Windows\\SysWOW64\\*", "?:\\Windows\\System32\\*", "?:\\Windows\\splwow64.exe", "?:\\Windows\\Microsoft.NET\\*") and

   /* DLL loaded from the process.executable current directory */
   endswith~(substring(dll.path, 0, length(dll.path) - (length(dll.name) + 1)), substring(process.executable, 0, length(process.executable) - (length(process.name) + 1)))]
[library where
  dll.name : ("ws2_32.dll", "wininet.dll", "winhttp.dll") and
  process.thread.Ext.call_stack_summary : "ntdll.dll|kernelbase.dll|Unbacked"]
'''

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

[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[threat.technique.subtechnique]]
id = "T1574.001"
name = "DLL"
reference = "https://attack.mitre.org/techniques/T1574/001/"



[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "8.7.0"

Stages and Predicates

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

Stage 1: library

[library where
   (dll.Ext.relative_file_creation_time < 5000 or
    dll.Ext.relative_file_name_modify_time < 5000 or
    (dll.Ext.device.product_id : ("Virtual DVD-ROM", "Virtual Disk","USB *") and not dll.path : "C:\\*")) and
    process.code_signature.trusted == true and
    not dll.code_signature.status : ("trusted", "errorExpired", "errorCode_endpoint*") and
    dll.hash.sha256 != null and
    not dll.hash.sha256 in ("e99fec7f1f2fe16029b4dbe30a96325efd7265c9cc8672f60945ce943684442d", "a654a64f0fbd2c34fc2b22cb41e2bf4ac32bd15ae6620e6a4198beb5270790f6") and
    (process.thread.Ext.call_stack_summary : "ntdll.dll*" and not process.thread.Ext.call_stack_summary : "*Unbacked*") and
    not dll.path : ("?:\\Windows\\Installer\\*",
                   "?:\\Windows\\System32\\DriverStore\\FileRepository\\*",
                   "?:\\Windows\\SysWOW64\\DriverStore\\FileRepository\\*",
                   "?:\\Program Files\\*",
                   "?:\\Program Files (x86)\\*",
                   "?:\\Windows\\assembly\\*") and
   not process.executable :
             ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe", "?:\\Windows\\Explorer.exe",
              "?:\\Windows\\SysWOW64\\*", "?:\\Windows\\System32\\*", "?:\\Windows\\splwow64.exe", "?:\\Windows\\Microsoft.NET\\*") and
   endswith~(substring(dll.path, 0, length(dll.path) - (length(dll.name) + 1)), substring(process.executable, 0, length(process.executable) - (length(process.name) + 1)))]

Stage 2: library

[library where
  dll.name : ("ws2_32.dll", "wininet.dll", "winhttp.dll") and
  process.thread.Ext.call_stack_summary : "ntdll.dll|kernelbase.dll|Unbacked"]

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
dll.code_signature.statuswildcardtrusted, errorExpired, errorCode_endpoint*excludes:dll.code_signature.status field:"dll.code_signature.status" value:"trusted" field:"dll.code_signature.status" value:"errorExpired" field:"dll.code_signature.status" value:"errorCode_endpoint*"
dll.hash.sha256ina654a64f0fbd2c34fc2b22cb41e2bf4ac32bd15ae6620e6a4198beb5270790f6, e99fec7f1f2fe16029b4dbe30a96325efd7265c9cc8672f60945ce943684442dexcludes:dll.hash.sha256 field:"dll.hash.sha256" value:"a654a64f0fbd2c34fc2b22cb41e2bf4ac32bd15ae6620e6a4198beb5270790f6" field:"dll.hash.sha256" value:"e99fec7f1f2fe16029b4dbe30a96325efd7265c9cc8672f60945ce943684442d"
dll.pathstarts_with?:\Windows\Installer\, ?:\Windows\System32\DriverStore\FileRepository\, ?:\Windows\SysWOW64\DriverStore\FileRepository\, ?:\Program Files\, ?:\Program Files (x86)\, ?:\Windows\assembly\excludes:dll.path
process.executablewildcard?:\Program Files\*.exe, ?:\Program Files (x86)\*.exe, ?:\Windows\Explorer.exe, ?:\Windows\SysWOW64\*, ?:\Windows\System32\*, ?:\Windows\splwow64.exe, ?:\Windows\Microsoft.NET\*excludes:process.executable
process.thread.Ext.call_stack_summarymatchUnbackedexcludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"Unbacked"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dll.Ext.device.product_idwildcard
  • USB *
  • Virtual DVD-ROM corpus 5 (elastic 5)
  • Virtual Disk corpus 5 (elastic 5)
field:"dll.Ext.device.product_id" kind:wildcard
dll.Ext.relative_file_creation_timelt
  • 5000 transforms: number corpus 6 (elastic 6)
field:"dll.Ext.relative_file_creation_time" kind:lt value:"5000"
dll.Ext.relative_file_name_modify_timelt
  • 5000 transforms: number corpus 6 (elastic 6)
field:"dll.Ext.relative_file_name_modify_time" kind:lt value:"5000"
dll.hash.sha256is_not_null
  • (no value, null check)
field:"Hashes" kind:is_not_null
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.code_signature.trustedeq
  • true transforms: boolean corpus 14 (elastic 14)
field:"process.code_signature.trusted" kind:eq value:"true"
process.thread.Ext.call_stack_summarywildcard
  • ntdll.dll* corpus 4 (elastic 4)
  • ntdll.dll|kernelbase.dll|Unbacked corpus 6 (elastic 6)
field:"process.thread.Ext.call_stack_summary" kind:wildcard