Detection rules › Elastic
Suspicious Powershell Child Process
Detects when Powershell (pwsh) spawns a highly abnormal or suspicious child process. Powershell usage on macOS is extremely rare but usage of Powershell to spawn a process like curl or osascript is almost always indicative of malicious behavior.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution |
Rule body
[rule]
description = """
Detects when Powershell (pwsh) spawns a highly abnormal or suspicious child process. Powershell usage on macOS is
extremely rare but usage of Powershell to spawn a process like curl or osascript is almost always indicative of
malicious behavior.
"""
id = "72f9191c-f099-4349-8c73-794b4ee8c4ea"
license = "Elastic License v2"
name = "Suspicious Powershell Child Process"
os_list = ["macos"]
version = "1.0.14"
query = '''
process where event.type == "start" and
(process.parent.name == "pwsh" or process.Ext.effective_parent.name == "pwsh") and
process.name like~ ("curl", "nscurl", "osascript") and
not process.args like~ "http://localhost*"
'''
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.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[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
(process.parent.name == "pwsh" or process.Ext.effective_parent.name == "pwsh") and
process.name like~ ("curl", "nscurl", "osascript") and
not process.args like~ "http://localhost*"
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | starts_with | http://localhost | excludes:process.args field:"process.args" value:"http://localhost" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.Ext.effective_parent.name | eq |
| field:"process.Ext.effective_parent.name" kind:eq value:"pwsh" |
process.name | wildcard |
| field:"process_name" kind:wildcard |
process.parent.name | eq |
| field:"parent_process_name" kind:eq value:"pwsh" |