Detection rules › Elastic
Code Editor Untrusted or Unsigned Child Process Execution
Detects when a code editor (VSCode, Cursor, or IntelliJ IDEA) spawns a shell to execute a self-signed and untrusted binary. This activity is indicative of a malicious 3rd party plugin or extension.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution |
Telemetry coverage
Rule body
[rule]
description = """
Detects when a code editor (VSCode, Cursor, or IntelliJ IDEA) spawns a shell to execute a self-signed and untrusted
binary. This activity is indicative of a malicious 3rd party plugin or extension.
"""
id = "9b9776bb-6bf3-4c06-94ff-64159b52a2f3"
license = "Elastic License v2"
name = "Code Editor Untrusted or Unsigned Child Process Execution"
os_list = ["macos"]
version = "1.0.19"
query = '''
process where event.type == "start" and event.action == "exec" and
process.Ext.effective_parent.executable in ("/Applications/IntelliJ IDEA.app/Contents/MacOS/idea",
"/Applications/Visual Studio Code.app/Contents/MacOS/Electron",
"/Applications/Cursor.app/Contents/MacOS/Cursor") and
process.parent.name in ("bash", "sh", "zsh") and
(process.code_signature.trusted == false or process.code_signature.exists == false) and
process.code_signature.signing_id regex~ """[A-Za-z0-9\_\s]{2,}\-[a-z0-9]{40}""" and
process.args_count <= 4 and
not process.executable like~
("/opt/homebrew/*",
"/Users/*/.homebrew/Cellar/*",
"/nix/store/*",
"/usr/local/microsoft/powershell/7/pwsh",
"/usr/local/Cellar/*",
"/opt/nordic/ncs/toolchains/*/Cellar/*",
"/Users/*/homebrew/Cellar/*") and
not process.command_line like~ ("bento completion zsh --silent", "*http://localhost*") and
not process.code_signature.signing_id like~ ("python3-*",
"ruby-*",
"python-*",
"node-*",
"rg-*")
'''
min_endpoint_version = "8.7.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.7.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and
process.Ext.effective_parent.executable in ("/Applications/IntelliJ IDEA.app/Contents/MacOS/idea",
"/Applications/Visual Studio Code.app/Contents/MacOS/Electron",
"/Applications/Cursor.app/Contents/MacOS/Cursor") and
process.parent.name in ("bash", "sh", "zsh") and
(process.code_signature.trusted == false or process.code_signature.exists == false) and
process.code_signature.signing_id regex~ """[A-Za-z0-9\_\s]{2,}\-[a-z0-9]{40}""" and
process.args_count <= 4 and
not process.executable like~
("/opt/homebrew/*",
"/Users/*/.homebrew/Cellar/*",
"/nix/store/*",
"/usr/local/microsoft/powershell/7/pwsh",
"/usr/local/Cellar/*",
"/opt/nordic/ncs/toolchains/*/Cellar/*",
"/Users/*/homebrew/Cellar/*") and
not process.command_line like~ ("bento completion zsh --silent", "*http://localhost*") and
not process.code_signature.signing_id like~ ("python3-*",
"ruby-*",
"python-*",
"node-*",
"rg-*")
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.signing_id | starts_with | python3-, ruby-, python-, node-, rg- | excludes:process.code_signature.signing_id |
process.command_line | wildcard | bento completion zsh --silent, *http://localhost* | excludes:process.command_line field:"process.command_line" value:"bento completion zsh --silent" field:"process.command_line" value:"*http://localhost*" |
process.executable | wildcard | /opt/homebrew/*, /Users/*/.homebrew/Cellar/*, /nix/store/*, /usr/local/microsoft/powershell/7/pwsh, /usr/local/Cellar/*, /opt/nordic/ncs/toolchains/*/Cellar/*, /Users/*/homebrew/Cellar/* | excludes:process.executable |
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.Ext.effective_parent.executable | in |
| field:"process.Ext.effective_parent.executable" kind:in |
process.args_count | le |
| field:"process.args_count" kind:le value:"4" |
process.code_signature.exists | eq |
| field:"process.code_signature.exists" kind:eq value:"false" |
process.code_signature.signing_id | regex_match |
| field:"process.code_signature.signing_id" kind:regex_match value:"[A-Za-z0-9\_\s]{2,}\-[a-z0-9]{40}" |
process.code_signature.trusted | eq |
| field:"process.code_signature.trusted" kind:eq value:"false" |
process.parent.name | in |
| field:"parent_process_name" kind:in |