Detection rules › Elastic
Cursor Arbitrary Code Execution via PHP
Cursor disables a crucial security feature: Workspace Trust, which in VS Code helps prevent inadvertently running unsafe scripts or extensions. This omission poses a risk: attackers could embed malicious configurations like a .vscode/settings.json pointing to a harmful executable and trigger code execution just by opening a project. This rule detects the exploitation of this feature.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Execution |
Telemetry coverage
Rule body
[rule]
description = """
Cursor disables a crucial security feature: Workspace Trust, which in VS Code helps prevent inadvertently running unsafe
scripts or extensions. This omission poses a risk: attackers could embed malicious configurations like a
.vscode/settings.json pointing to a harmful executable and trigger code execution just by opening a project. This rule
detects the exploitation of this feature.
"""
id = "44e414c9-e072-48ef-9783-ee692619e028"
license = "Elastic License v2"
name = "Cursor Arbitrary Code Execution via PHP"
os_list = ["macos"]
reference = ["https://www.imperva.com/blog/cursors-magic-comes-with-a-catch-missing-trust-setting/"]
version = "1.0.5"
query = '''
process where event.type == "start" and event.action == "exec" and process.parent.code_signature.team_id == "VDXQ22DGB9" and
(process.name in ("bash", "sh", "zsh", "dash", "csh", "tcsh", "ksh", "tclsh", "fish") or process.name like "tclsh*") and process.args like "/Users/*/.vscode/run" and
process.args like "/Users/*.php"
'''
min_endpoint_version = "8.16.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 = "T1195"
name = "Supply Chain Compromise"
reference = "https://attack.mitre.org/techniques/T1195/"
[[threat.technique.subtechnique]]
id = "T1195.001"
name = "Compromise Software Dependencies and Development Tools"
reference = "https://attack.mitre.org/techniques/T1195/001/"
[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[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.16.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and process.parent.code_signature.team_id == "VDXQ22DGB9" and
(process.name in ("bash", "sh", "zsh", "dash", "csh", "tcsh", "ksh", "tclsh", "fish") or process.name like "tclsh*") and process.args like "/Users/*/.vscode/run" and
process.args like "/Users/*.php"
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 | wildcard |
| field:"process.args" kind:wildcard |
process.name | in |
| field:"process_name" kind:in |
process.name | wildcard |
| field:"process_name" kind:wildcard value:"tclsh*" |
process.parent.code_signature.team_id | eq |
| field:"process.parent.code_signature.team_id" kind:eq value:"VDXQ22DGB9" |