Detection rules › Elastic
Initial Access or Execution via Microsoft Office Application
Identifies when a Microsoft Office process spawns a descendant process used for initial access or malicious code execution. This behavior is consistent with a user opening an Office document that contains malicious macros.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Execution | |
| Persistence | |
| Stealth | |
| Defense Impairment | |
| Command & Control |
Telemetry coverage
Rule body
[rule]
description = """
Identifies when a Microsoft Office process spawns a descendant process used for initial access or malicious code
execution. This behavior is consistent with a user opening an Office document that contains malicious macros.
"""
id = "64021ef9-19d3-4797-ac3c-79e38d5e5a5a"
license = "Elastic License v2"
name = "Initial Access or Execution via Microsoft Office Application"
os_list = ["macos"]
reference = ["https://objective-see.com/blog/blog_0x4B.html"]
version = "1.0.41"
query = '''
process where event.action == "exec" and
descendant of [
process where event.action == "exec" and
process.name in (
"Microsoft Word",
"Microsoft Excel",
"Microsoft PowerPoint",
"Microsoft OneNote"
)
] and
process.name like~ (
"curl",
"nscurl",
"bash",
"sh",
"osascript",
"python*",
"perl*",
"mktemp",
"chmod",
"php",
"nohup",
"openssl",
"plutil",
"PlistBuddy",
"xattr",
"mktemp",
"sqlite3",
"funzip",
"popen"
) and
// Filter FPs related to product version discovery and Office error reporting behavior
not process.args like~
(
"ProductVersion",
"hw.model",
"ioreg",
"ProductName",
"ProductUserVisibleVersion",
"ProductBuildVersion",
"/Library/Application Support/Microsoft/MERP*/Microsoft Error Reporting.app/Contents/MacOS/Microsoft Error Reporting",
"open -a Safari *",
"defaults read *",
"sysctl hw.model*",
"ioreg -d2 -c IOPlatformExpertDevice *",
"ps aux | grep 'ToDesk_Desktop' | grep -v grep",
"PIPE=\"$CFFIXED_USER_HOME/.zoteroIntegrationPipe*",
"/Library/Management/super/com.macjutsu.super.plist",
"\"/Applications/Mendeley Desktop.app/Contents/MacOS/MendeleyWordPlugin.app/Contents/MacOS/MendeleyWordPlugin\" setPort *",
"http://127.0.0.1:23119/integration/macWordCommand?*",
"curl -s -o /dev/null -I -m 2 -w '%{http_code}' -X GET 'http://127.0.0.1:23119/integration/macWordCommand?agent=*'",
"*/Applications/XLSTAT.app/*"
) and
not process.parent.executable like~
(
"/Applications/ToDesk.app/Contents/MacOS/ToDesk_Service",
"/usr/local/Privacy-i/PISupervisor",
"/Library/Addigy/lan-cache",
"/Library/Elastic/Agent/*",
"/opt/jc/bin/jumpcloud-agent",
"/usr/sbin/networksetup"
) and
not (process.name == "sh" and process.command_line like~ "*$CFFIXED_USER_HOME/.zoteroIntegrationPipe*") and
not (process.name in ("sh", "bash", "curl") and process.command_line like~ "*http://127.0.0.1:6969/binary*ppShuttle_*.bin*") and
not process.Ext.effective_parent.executable like~ (
"/Applications/ToDesk.app/Contents/MacOS/ToDesk_Service",
"/Applications/Docker.app/Contents/MacOS/com.docker.backend",
"/Applications/FortiClient.app/Contents/Resources/runtime.helper/FortiClientAgent.app/Contents/MacOS/FortiClientAgent",
"/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon",
"/Applications/Microsoft Defender.app/Contents/MacOS/wdavdaemon",
"/Library/Intune/Microsoft Intune Agent.app/Contents/MacOS/IntuneMdmDaemon",
"/usr/local/Privacy-i/PISupervisor",
"/usr/local/jamf/bin/jamf",
"/Library/Addigy/auditor",
"/Library/Elastic/Agent/*",
"/opt/jc/bin/jumpcloud-agent",
"/usr/sbin/networksetup"
)
'''
min_endpoint_version = "8.5.0"
optional_actions = []
[[actions]]
action = "kill_process"
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/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[[threat.technique.subtechnique]]
id = "T1059.006"
name = "Python"
reference = "https://attack.mitre.org/techniques/T1059/006/"
[[threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[[threat.technique]]
id = "T1204"
name = "User Execution"
reference = "https://attack.mitre.org/techniques/T1204/"
[[threat.technique.subtechnique]]
id = "T1204.002"
name = "Malicious File"
reference = "https://attack.mitre.org/techniques/T1204/002/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1547"
name = "Boot or Logon Autostart Execution"
reference = "https://attack.mitre.org/techniques/T1547/"
[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"
[[threat.technique]]
id = "T1140"
name = "Deobfuscate/Decode Files or Information"
reference = "https://attack.mitre.org/techniques/T1140/"
[[threat.technique]]
id = "T1647"
name = "Plist File Modification"
reference = "https://attack.mitre.org/techniques/T1647/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"
[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[internal]
min_endpoint_version = "8.5.0"
Stages and Predicates
Stage 1: process
process where event.action == "exec" and
descendant of [
process where event.action == "exec" and
process.name in (
"Microsoft Word",
"Microsoft Excel",
"Microsoft PowerPoint",
"Microsoft OneNote"
)
] and
process.name like~ (
"curl",
"nscurl",
"bash",
"sh",
"osascript",
"python*",
"perl*",
"mktemp",
"chmod",
"php",
"nohup",
"openssl",
"plutil",
"PlistBuddy",
"xattr",
"mktemp",
"sqlite3",
"funzip",
"popen"
) and
not process.args like~
(
"ProductVersion",
"hw.model",
"ioreg",
"ProductName",
"ProductUserVisibleVersion",
"ProductBuildVersion",
"/Library/Application Support/Microsoft/MERP*/Microsoft Error Reporting.app/Contents/MacOS/Microsoft Error Reporting",
"open -a Safari *",
"defaults read *",
"sysctl hw.model*",
"ioreg -d2 -c IOPlatformExpertDevice *",
"ps aux | grep 'ToDesk_Desktop' | grep -v grep",
"PIPE=\"$CFFIXED_USER_HOME/.zoteroIntegrationPipe*",
"/Library/Management/super/com.macjutsu.super.plist",
"\"/Applications/Mendeley Desktop.app/Contents/MacOS/MendeleyWordPlugin.app/Contents/MacOS/MendeleyWordPlugin\" setPort *",
"http://127.0.0.1:23119/integration/macWordCommand?*",
"curl -s -o /dev/null -I -m 2 -w '%{http_code}' -X GET 'http://127.0.0.1:23119/integration/macWordCommand?agent=*'",
"*/Applications/XLSTAT.app/*"
) and
not process.parent.executable like~
(
"/Applications/ToDesk.app/Contents/MacOS/ToDesk_Service",
"/usr/local/Privacy-i/PISupervisor",
"/Library/Addigy/lan-cache",
"/Library/Elastic/Agent/*",
"/opt/jc/bin/jumpcloud-agent",
"/usr/sbin/networksetup"
) and
not (process.name == "sh" and process.command_line like~ "*$CFFIXED_USER_HOME/.zoteroIntegrationPipe*") and
not (process.name in ("sh", "bash", "curl") and process.command_line like~ "*http://127.0.0.1:6969/binary*ppShuttle_*.bin*") and
not process.Ext.effective_parent.executable like~ (
"/Applications/ToDesk.app/Contents/MacOS/ToDesk_Service",
"/Applications/Docker.app/Contents/MacOS/com.docker.backend",
"/Applications/FortiClient.app/Contents/Resources/runtime.helper/FortiClientAgent.app/Contents/MacOS/FortiClientAgent",
"/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon",
"/Applications/Microsoft Defender.app/Contents/MacOS/wdavdaemon",
"/Library/Intune/Microsoft Intune Agent.app/Contents/MacOS/IntuneMdmDaemon",
"/usr/local/Privacy-i/PISupervisor",
"/usr/local/jamf/bin/jamf",
"/Library/Addigy/auditor",
"/Library/Elastic/Agent/*",
"/opt/jc/bin/jumpcloud-agent",
"/usr/sbin/networksetup"
)
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.command_line | match | $CFFIXED_USER_HOME/.zoteroIntegrationPipe | excludes:process.command_line field:"process.command_line" value:"$CFFIXED_USER_HOME/.zoteroIntegrationPipe" |
process.name | eq | sh | excludes:process.name field:"process.name" value:"sh" |
process.command_line | wildcard | *http://127.0.0.1:6969/binary*ppShuttle_*.bin* | excludes:process.command_line field:"process.command_line" value:"*http://127.0.0.1:6969/binary*ppShuttle_*.bin*" |
process.name | in | bash, curl, sh | excludes:process.name field:"process.name" value:"bash" field:"process.name" value:"curl" field:"process.name" value:"sh" |
process.Ext.effective_parent.executable | wildcard | /Applications/ToDesk.app/Contents/MacOS/ToDesk_Service, /Applications/Docker.app/Contents/MacOS/com.docker.backend, /Applications/FortiClient.app/Contents/Resources/runtime.helper/FortiClientAgent.app/Contents/MacOS/FortiClientAgent, /Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon, /Applications/Microsoft Defender.app/Contents/MacOS/wdavdaemon, /Library/Intune/Microsoft Intune Agent.app/Contents/MacOS/IntuneMdmDaemon, /usr/local/Privacy-i/PISupervisor, /usr/local/jamf/bin/jamf, /Library/Addigy/auditor, /Library/Elastic/Agent/*, /opt/jc/bin/jumpcloud-agent, /usr/sbin/networksetup | excludes:process.Ext.effective_parent.executable |
process.args | wildcard | ProductVersion, hw.model, ioreg, ProductName, ProductUserVisibleVersion, ProductBuildVersion, /Library/Application Support/Microsoft/MERP*/Microsoft Error Reporting.app/Contents/MacOS/Microsoft Error Reporting, open -a Safari *, defaults read *, sysctl hw.model*, ioreg -d2 -c IOPlatformExpertDevice *, ps aux | grep 'ToDesk_Desktop' | grep -v grep, PIPE="$CFFIXED_USER_HOME/.zoteroIntegrationPipe*, /Library/Management/super/com.macjutsu.super.plist, "/Applications/Mendeley Desktop.app/Contents/MacOS/MendeleyWordPlugin.app/Contents/MacOS/MendeleyWordPlugin" setPort *, http://127.0.0.1:23119/integration/macWordCommand?*, curl -s -o /dev/null -I -m 2 -w '%{http_code}' -X GET 'http://127.0.0.1:23119/integration/macWordCommand?agent=*', */Applications/XLSTAT.app/* | excludes:process.args |
process.parent.executable | wildcard | /Applications/ToDesk.app/Contents/MacOS/ToDesk_Service, /usr/local/Privacy-i/PISupervisor, /Library/Addigy/lan-cache, /Library/Elastic/Agent/*, /opt/jc/bin/jumpcloud-agent, /usr/sbin/networksetup | excludes:process.parent.executable |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
process.name | wildcard |
| field:"process_name" kind:wildcard |