Detection rules › Elastic
Execution of File Written or Modified by Microsoft Office
Identifies when a Microsoft Office process creates a portable executable (PE) file and the file is subsequently executed. An adversary may deliver a weaponized Office document to their target that writes and executes a malicious PE file.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Initial Access |
Rule body
[rule]
description = """
Identifies when a Microsoft Office process creates a portable executable (PE) file and the file is subsequently
executed. An adversary may deliver a weaponized Office document to their target that writes and executes a malicious PE
file.
"""
id = "901f0c30-a7c5-40c5-80e3-a50c6744632f"
license = "Elastic License v2"
name = "Execution of File Written or Modified by Microsoft Office"
os_list = ["windows"]
version = "1.0.31"
query = '''
sequence with maxspan=2m
[ file where event.action != "deletion" and
process.name : ("WINWORD.EXE", "EXCEL.EXE", "POWERPNT.EXE", "MSACCESS.EXE") and
// Match Windows PE files by header data (MZ)
file.Ext.header_bytes : "4d5a*" and
not file.extension : ("exe", "com") ] by file.path
[ process where event.action == "start" ] by process.executable
'''
min_endpoint_version = "7.15.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.technique.subtechnique]]
id = "T1566.002"
name = "Spearphishing Link"
reference = "https://attack.mitre.org/techniques/T1566/002/"
[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 2m, correlated by file.path, process.executable.
Stage 1: file
[ file where event.action != "deletion" and
process.name : ("WINWORD.EXE", "EXCEL.EXE", "POWERPNT.EXE", "MSACCESS.EXE") and
file.Ext.header_bytes : "4d5a*" and
not file.extension : ("exe", "com") ] by file.path
Stage 2: process
[ process where event.action == "start" ] by process.executable
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.extension | eq | exe, com | excludes:file.extension field:"file.extension" value:"exe" field:"file.extension" value:"com" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
event.action | ne |
| field:"EventType" kind:ne value:"deletion" |
file.Ext.header_bytes | wildcard |
| field:"file.Ext.header_bytes" kind:wildcard value:"4d5a*" |
process.name | wildcard |
| field:"process_name" kind:wildcard |