Detection rules › Elastic

Suspicious File Dropped by a Macro Enabled Document

Source
github.com/elastic/protections-artifacts

Identifies when a Microsoft Office process writes an executable file type and from a call stack pointing to Microsoft Office Visual Basic for Applications modules. This may indicate an attempt to get initial access using malicious macro enabled documents.

MITRE ATT&CK coverage

TacticTechniques
Initial Access

Rule body

[rule]
description = """
Identifies when a Microsoft Office process writes an executable file type and from a call stack pointing to Microsoft
Office Visual Basic for Applications modules. This may indicate an attempt to get initial access using malicious macro
enabled documents.
"""
id = "9eca0b31-cf47-4120-afe9-9badb0c308e0"
license = "Elastic License v2"
name = "Suspicious File Dropped by a Macro Enabled Document"
os_list = ["windows"]
reference = [
    "https://www.elastic.co/security-labs/upping-the-ante-detecting-in-memory-threats-with-kernel-call-stacks",
]
version = "1.0.22"

query = '''
file where event.action != "deletion" and event.action != "open" and
   process.name : ("WINWORD.EXE", "EXCEL.EXE", "POWERPNT.EXE", "mspub.exe", "fltldr.exe", "visio.exe") and
   process.thread.Ext.call_stack_summary : "*|vbe?.dll*" and
   (file.extension : ("exe", "pif", "scr", "iso", "rar", "7z", "img", "vhd", "js", "vbs", "wsh", "hta", "cpl", "jse", "vbe", "bat", "cmd", "dll") or
    file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*", "3c736372697074206c616e6775616765", "76617220*")) and
   not (file.extension == "zip" and file.Ext.header_bytes == "504b0506000000000000000000000000")
'''

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 = "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/"

[internal]
min_endpoint_version = "8.7.0"

Stages and Predicates

Stage 1: file

file where event.action != "deletion" and event.action != "open" and
   process.name : ("WINWORD.EXE", "EXCEL.EXE", "POWERPNT.EXE", "mspub.exe", "fltldr.exe", "visio.exe") and
   process.thread.Ext.call_stack_summary : "*|vbe?.dll*" and
   (file.extension : ("exe", "pif", "scr", "iso", "rar", "7z", "img", "vhd", "js", "vbs", "wsh", "hta", "cpl", "jse", "vbe", "bat", "cmd", "dll") or
    file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*", "3c736372697074206c616e6775616765", "76617220*")) and
   not (file.extension == "zip" and file.Ext.header_bytes == "504b0506000000000000000000000000")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.Ext.header_byteseq504b0506000000000000000000000000excludes:file.Ext.header_bytes field:"file.Ext.header_bytes" value:"504b0506000000000000000000000000"
file.extensioneqzipexcludes:file.extension field:"file.extension" value:"zip"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionne
  • deletion corpus 86 (elastic 86)
  • open corpus 3 (elastic 3)
field:"EventType" kind:ne
file.Ext.header_byteswildcard
  • 3c736372697074206c616e6775616765
  • 406563686F*
  • 4d5a* corpus 46 (elastic 46)
  • 76617220*
  • TVqQ*
field:"file.Ext.header_bytes" kind:wildcard
file.extensionwildcard
  • 7z corpus 3 (elastic 3)
  • bat corpus 13 (elastic 13)
  • cmd corpus 15 (elastic 15)
  • cpl corpus 19 (elastic 19)
  • dll corpus 33 (elastic 33)
  • exe corpus 32 (elastic 32)
  • hta corpus 20 (elastic 20)
  • img corpus 4 (elastic 4)
  • iso corpus 4 (elastic 4)
  • js corpus 23 (elastic 23)
  • jse corpus 18 (elastic 18)
  • pif corpus 18 (elastic 18)
  • rar corpus 4 (elastic 4)
  • scr corpus 17 (elastic 17)
  • vbe corpus 18 (elastic 18)
  • vbs corpus 19 (elastic 19)
  • vhd corpus 3 (elastic 3)
  • wsh corpus 16 (elastic 16)
field:"file.extension" kind:wildcard
process.namewildcard
  • EXCEL.EXE corpus 34 (elastic 34)
  • POWERPNT.EXE corpus 31 (elastic 31)
  • WINWORD.EXE corpus 35 (elastic 35)
  • fltldr.exe corpus 8 (elastic 8)
  • mspub.exe corpus 15 (elastic 15)
  • visio.exe corpus 2 (elastic 2)
field:"process_name" kind:wildcard
process.thread.Ext.call_stack_summarywildcard
  • *|vbe?.dll* corpus 4 (elastic 4)
field:"process.thread.Ext.call_stack_summary" kind:wildcard value:"*|vbe?.dll*"