Detection rules › Elastic
Shell Script Execution from abnormal Volume Mount Path
Detects the suspicious execution of a shell script from a volume mount path and outside of the standard macOS binary execution path (/Volumes/name.app/Contents/MacOS/binary). This activity is highly abnormal and should indicate potentially malicious activity. Threat actors have used shell scripts like this in order to download additional tools/payloads and prepare the system for post-infection actions by establishing persistence, altering file attributes and creating necessary directories.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution |
Telemetry coverage
Rule body
[rule]
description = """
Detects the suspicious execution of a shell script from a volume mount path and outside of the standard macOS binary
execution path (/Volumes/name.app/Contents/MacOS/binary). This activity is highly abnormal and should indicate
potentially malicious activity. Threat actors have used shell scripts like this in order to download additional
tools/payloads and prepare the system for post-infection actions by establishing persistence, altering file attributes
and creating necessary directories.
"""
id = "87def154-004d-4d3a-8224-591e41804454"
license = "Elastic License v2"
name = "Shell Script Execution from abnormal Volume Mount Path"
os_list = ["macos"]
reference = ["https://objective-see.org/blog/blog_0x71.html"]
version = "1.0.22"
query = '''
process where event.type == "start" and event.action == "exec" and
process.name like~ ("bash", "sh", "zsh", "tclsh*") and
process.args like~ "/Volumes/*/Contents/*" and
process.args_count <= 3 and
process.parent.executable like~ "/Volumes/*" and not
process.args like~ ("/Volumes/*/Contents/MacOS/*", "/Volumes/*/Contents/Eclipse/*") and not
process.Ext.effective_parent.executable like~ "/Volumes/*"
'''
min_endpoint_version = "8.5.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[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.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[internal]
min_endpoint_version = "8.5.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and
process.name like~ ("bash", "sh", "zsh", "tclsh*") and
process.args like~ "/Volumes/*/Contents/*" and
process.args_count <= 3 and
process.parent.executable like~ "/Volumes/*" and not
process.args like~ ("/Volumes/*/Contents/MacOS/*", "/Volumes/*/Contents/Eclipse/*") and not
process.Ext.effective_parent.executable like~ "/Volumes/*"
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.Ext.effective_parent.executable | starts_with | /Volumes/ | excludes:process.Ext.effective_parent.executable field:"process.Ext.effective_parent.executable" value:"/Volumes/" |
process.args | wildcard | /Volumes/*/Contents/MacOS/*, /Volumes/*/Contents/Eclipse/* | excludes:process.args field:"process.args" value:"/Volumes/*/Contents/MacOS/*" field:"process.args" value:"/Volumes/*/Contents/Eclipse/*" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard value:"/Volumes/*/Contents/*" |
process.args_count | le |
| field:"process.args_count" kind:le value:"3" |
process.name | wildcard |
| field:"process_name" kind:wildcard |
process.parent.executable | wildcard |
| field:"ParentImage" kind:wildcard value:"/Volumes/*" |