Detection rules › Elastic
Execution via Electron Child Process Node.js Module
Identifies attempts to execute a child process from within the context of an Electron application using the child_process Node.js module. Adversaries may abuse this technique to inherit permissions from parent processes.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Privilege Escalation |
Telemetry coverage
Rule body
[rule]
description = """
Identifies attempts to execute a child process from within the context of an Electron application using the
child_process Node.js module. Adversaries may abuse this technique to inherit permissions from parent processes.
"""
id = "1d43f87d-2466-4714-8fef-d52816cc25fb"
license = "Elastic License v2"
name = "Execution via Electron Child Process Node.js Module"
os_list = ["macos"]
reference = [
"https://www.matthewslipper.com/2019/09/22/everything-you-wanted-electron-child-process.html",
"https://www.trustedsec.com/blog/macos-injection-via-third-party-frameworks/",
"https://nodejs.org/api/child_process.html",
]
version = "1.0.35"
query = '''
process where event.action == "exec" and
process.args == "-e" and process.command_line like~ "*require*child_process*" and
process.command_line like~ "*spawn*" and
(
/* Spawning shells with inline commands */
process.command_line like~ ("*spawn*bash*-c*", "*spawn*sh*-c*", "*spawn*zsh*-c*") or
/* Spawning curl/wget for download */
process.command_line like~ ("*spawn*curl*", "*spawn*wget*") or
/* Spawning osascript */
process.command_line like~ "*spawn*osascript*" or
/* Spawning python with inline code */
process.command_line like~ "*spawn*python*-c*" or
/* Base64 decode patterns */
process.command_line like~ "*spawn*base64*" or
/* Execution from suspicious staging paths */
process.command_line like~ ("*spawn*/tmp/*", "*spawn*/Users/Shared/*", "*spawn*/private/tmp/*", "*spawn*/var/tmp/*")
) and
not process.executable like
("/usr/bin/grep",
"/Applications/Docker.app/Contents/Resources/bin/docker",
"/Applications/Docker.app/Contents/Resources/bin/com.docker.cli")
'''
min_endpoint_version = "8.10.2"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.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.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.10.2"
Stages and Predicates
Stage 1: process
process where event.action == "exec" and
process.args == "-e" and process.command_line like~ "*require*child_process*" and
process.command_line like~ "*spawn*" and
(
process.command_line like~ ("*spawn*bash*-c*", "*spawn*sh*-c*", "*spawn*zsh*-c*") or
process.command_line like~ ("*spawn*curl*", "*spawn*wget*") or
process.command_line like~ "*spawn*osascript*" or
process.command_line like~ "*spawn*python*-c*" or
process.command_line like~ "*spawn*base64*" or
process.command_line like~ ("*spawn*/tmp/*", "*spawn*/Users/Shared/*", "*spawn*/private/tmp/*", "*spawn*/var/tmp/*")
) and
not process.executable like
("/usr/bin/grep",
"/Applications/Docker.app/Contents/Resources/bin/docker",
"/Applications/Docker.app/Contents/Resources/bin/com.docker.cli")
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | eq | /usr/bin/grep, /Applications/Docker.app/Contents/Resources/bin/docker, /Applications/Docker.app/Contents/Resources/bin/com.docker.cli | excludes:process.executable field:"process.executable" value:"/usr/bin/grep" field:"process.executable" value:"/Applications/Docker.app/Contents/Resources/bin/docker" field:"process.executable" value:"/Applications/Docker.app/Contents/Resources/bin/com.docker.cli" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
process.args | eq |
| field:"process.args" kind:eq value:"-e" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |