Execution via Electron Child Process Node.js Module


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.

Query · eql

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") and
 not process.Ext.effective_parent.executable like 
    ("/Users/*/Library/Application Support/Claude/claude-code/*/claude.app/Contents/MacOS/claude",
      "/Applications/ChatGPT.app/Contents/MacOS/ChatGPT")
Raw source Execution via Electron Child Process Node.js Module · Elastic TOML
Esc
Published by elastic/protections-artifacts ↗, licensed under Elastic License 2.0 ↗. Reproduced here unmodified.
[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.36"

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") and
 not process.Ext.effective_parent.executable like 
    ("/Users/*/Library/Application Support/Claude/claude-code/*/claude.app/Contents/MacOS/claude",
      "/Applications/ChatGPT.app/Contents/MacOS/ChatGPT")
'''

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"

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.