Detection rules › Elastic
MacOS Interactive Shell Spawned via Hidden Process
Detects when a hidden process spawns an interactive shell. Many different types of malware will create and execute hidden binaries in order to avoid suspicion or detection by a user. Sometimes depending on the implementation a payload will open an interactive shell on the target system in order to execute post exploitation commands in real time.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution |
Telemetry coverage
Rule body
[rule]
description = """
Detects when a hidden process spawns an interactive shell. Many different types of malware will create and execute
hidden binaries in order to avoid suspicion or detection by a user. Sometimes depending on the implementation a payload
will open an interactive shell on the target system in order to execute post exploitation commands in real time.
"""
id = "8d6b1c6b-fd51-4a56-bc34-ea91f9921651"
license = "Elastic License v2"
name = "MacOS Interactive Shell Spawned via Hidden Process"
os_list = ["macos"]
version = "1.0.5"
query = '''
process where event.type == "start" and event.action == "exec" and (process.name in ("bash", "sh", "zsh", "dash", "csh", "tcsh", "ksh", "tclsh", "fish") or process.name like "tclsh*") and
process.args == "-i" and process.args_count == 2 and
process.parent.name like~ ".*"
'''
min_endpoint_version = "8.11.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.11.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and (process.name in ("bash", "sh", "zsh", "dash", "csh", "tcsh", "ksh", "tclsh", "fish") or process.name like "tclsh*") and
process.args == "-i" and process.args_count == 2 and
process.parent.name like~ ".*"
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 | eq |
| field:"process.args" kind:eq value:"-i" |
process.args_count | eq |
| field:"process.args_count" kind:eq value:"2" |
process.name | in |
| field:"process_name" kind:in |
process.name | wildcard |
| field:"process_name" kind:wildcard value:"tclsh*" |
process.parent.name | wildcard |
| field:"parent_process_name" kind:wildcard value:".*" |