Detection rules › Elastic

DLL Side Loading of a file dropped by Microsoft Office

Time window
5m
Sequence by
dll.path, file.path
Source
github.com/elastic/protections-artifacts

Identifies when a Microsoft Office process creates an executable file (DLL) and the file is subsequently loaded by a trusted binary. An adversary may deliver a weaponized Office document to their target that writes and loads malicious modules.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies when a Microsoft Office process creates an executable file (DLL) and the file is subsequently loaded by a
trusted binary. An adversary may deliver a weaponized Office document to their target that writes and loads malicious
modules.
"""
id = "68218637-3940-42cb-b2b7-0610fc1dde56"
license = "Elastic License v2"
name = "DLL Side Loading of a file dropped by Microsoft Office"
os_list = ["windows"]
version = "1.0.21"

query = '''
sequence with maxspan=5m
  [ file where event.action != "deletion" and
      process.name :
          ("WINWORD.EXE",
           "EXCEL.EXE",
           "POWERPNT.EXE",
           "MSACCESS.EXE",
           "MSPUB.EXE") and
      (
        file.extension : ("dll", "cpl", "ocx") or
        // Match Windows PE files by header data (MZ)
        file.Ext.header_bytes : "4d5a*"
      ) ] by file.path
  [ library where
   (dll.code_signature.exists == false or
   (dll.code_signature.trusted == false and not dll.code_signature.status : ("trusted", "errorExpired", "errorCode_endpoint*"))) and
    process.code_signature.trusted == true and
    not process.name : ("WINWORD.EXE", "EXCEL.EXE", "POWERPNT.EXE", "MSACCESS.EXE", "ONENOTE.EXE") and
    not startswith~(dll.name, process.name) and
    not dll.hash.sha256 in ("ac0b2e4ea19c34536a58e6818fe0d37599495a6b3da7e8d3a3444ea0eff9d6e6", "d85639d208dc27961832b15eb42f9861faffca18e0ded8d5697c9bf13b7b598c") and
    not dll.path : "?:\\Windows\\assembly\\NativeImages_*" and
    not (process.executable : "?:\\Windows\\System32\\spoolsv.exe" and user.id : "S-1-5-18") and
    not process.executable : ("?:\\Windows\\SysWOW64\\msiexec.exe", "?:\\Windows\\system32\\msiexec.exe")
    ] by dll.path
'''

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

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

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1566"
name = "Phishing"
reference = "https://attack.mitre.org/techniques/T1566/"
[[threat.technique.subtechnique]]
id = "T1566.001"
name = "Spearphishing Attachment"
reference = "https://attack.mitre.org/techniques/T1566/001/"



[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[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.4.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 5m, correlated by dll.path, file.path.

Stage 1: file

[ file where event.action != "deletion" and
      process.name :
          ("WINWORD.EXE",
           "EXCEL.EXE",
           "POWERPNT.EXE",
           "MSACCESS.EXE",
           "MSPUB.EXE") and
      (
        file.extension : ("dll", "cpl", "ocx") or
        file.Ext.header_bytes : "4d5a*"
      ) ] by file.path

Stage 2: library

[ library where
   (dll.code_signature.exists == false or
   (dll.code_signature.trusted == false and not dll.code_signature.status : ("trusted", "errorExpired", "errorCode_endpoint*"))) and
    process.code_signature.trusted == true and
    not process.name : ("WINWORD.EXE", "EXCEL.EXE", "POWERPNT.EXE", "MSACCESS.EXE", "ONENOTE.EXE") and
    not startswith~(dll.name, process.name) and
    not dll.hash.sha256 in ("ac0b2e4ea19c34536a58e6818fe0d37599495a6b3da7e8d3a3444ea0eff9d6e6", "d85639d208dc27961832b15eb42f9861faffca18e0ded8d5697c9bf13b7b598c") and
    not dll.path : "?:\\Windows\\assembly\\NativeImages_*" and
    not (process.executable : "?:\\Windows\\System32\\spoolsv.exe" and user.id : "S-1-5-18") and
    not process.executable : ("?:\\Windows\\SysWOW64\\msiexec.exe", "?:\\Windows\\system32\\msiexec.exe")
    ] by dll.path

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.executableeq?:\Windows\System32\spoolsv.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\spoolsv.exe"
user.ideqS-1-5-18excludes:user.id field:"user.id" value:"S-1-5-18"
dll.hash.sha256inac0b2e4ea19c34536a58e6818fe0d37599495a6b3da7e8d3a3444ea0eff9d6e6, d85639d208dc27961832b15eb42f9861faffca18e0ded8d5697c9bf13b7b598cexcludes:dll.hash.sha256 field:"dll.hash.sha256" value:"ac0b2e4ea19c34536a58e6818fe0d37599495a6b3da7e8d3a3444ea0eff9d6e6" field:"dll.hash.sha256" value:"d85639d208dc27961832b15eb42f9861faffca18e0ded8d5697c9bf13b7b598c"
dll.namestarts_withprocess.nameexcludes:dll.name field:"dll.name" value:"process.name"
dll.pathstarts_with?:\Windows\assembly\NativeImages_excludes:dll.path field:"dll.path" value:"?:\Windows\assembly\NativeImages_"
process.executableeq?:\Windows\SysWOW64\msiexec.exe, ?:\Windows\system32\msiexec.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\SysWOW64\msiexec.exe" field:"process.executable" value:"?:\Windows\system32\msiexec.exe"
process.nameeqWINWORD.EXE, EXCEL.EXE, POWERPNT.EXE, MSACCESS.EXE, ONENOTE.EXEexcludes:process.name

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dll.code_signature.existseq
  • false transforms: boolean corpus 22 (elastic 22)
field:"dll.code_signature.exists" kind:eq value:"false"
dll.code_signature.trustedeq
  • false transforms: boolean corpus 21 (elastic 21)
field:"dll.code_signature.trusted" kind:eq value:"false"
event.actionne
  • deletion corpus 86 (elastic 86)
field:"EventType" kind:ne value:"deletion"
file.Ext.header_byteswildcard
  • 4d5a* corpus 46 (elastic 46)
field:"file.Ext.header_bytes" kind:wildcard value:"4d5a*"
file.extensionwildcard
  • cpl corpus 19 (elastic 19)
  • dll corpus 33 (elastic 33)
  • ocx corpus 6 (elastic 6)
field:"file.extension" kind:wildcard
process.code_signature.trustedeq
  • true transforms: boolean corpus 14 (elastic 14)
field:"process.code_signature.trusted" kind:eq value:"true"
process.namewildcard
  • EXCEL.EXE corpus 34 (elastic 34)
  • MSACCESS.EXE corpus 19 (elastic 19)
  • MSPUB.EXE corpus 15 (elastic 15)
  • POWERPNT.EXE corpus 31 (elastic 31)
  • WINWORD.EXE corpus 35 (elastic 35)
field:"process_name" kind:wildcard