Multiple Credential Access by VS Code or Cursor IDE Descendant
Detects a process descended from Visual Studio Code or Cursor opening at least two distinct sensitive files, such as browser credential stores, cloud tokens, or SSH and package-manager secrets. Malicious IDE extensions use the editor process tree to harvest more than one credential store in a single session.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2026/10/26"
3integration = ["endpoint"]
4maturity = "production"
5min_stack_comments = "ES|QL inline stats became generally available in 9.3.0 and MV_INTERSECTION is in preview since 9.3."
6min_stack_version = "9.4.0"
7updated_date = "2026/11/03"
8
9[rule]
10author = ["Elastic"]
11description = """
12Detects a process descended from Visual Studio Code or Cursor opening at least two distinct sensitive files, such as
13browser credential stores, cloud tokens, or SSH and package-manager secrets. Malicious IDE extensions use the editor
14process tree to harvest more than one credential store in a single session.
15"""
16from = "now-9m"
17language = "esql"
18license = "Elastic License v2"
19name = "Multiple Credential Access by VS Code or Cursor IDE Descendant"
20note = """## Triage and analysis
21
22### Investigating Multiple Credential Access by VS Code or Cursor IDE Descendant
23
24A process whose ancestry includes Visual Studio Code or Cursor opened at least two different sensitive files. The files
25include browser stores (`logins.json`, `Login Data`, `Cookies`), cloud and token files, and SSH or package-manager
26secrets. One such file can be normal for a language server or CLI. Two or more in the same process is credential
27harvesting behavior associated with a malicious extension or a prompt-injected agent.
28
29### Possible investigation steps
30
31- Review `Esql.file_names` and `file.path` for which stores were opened and whether the paths sit under a browser profile, `.aws`, `.ssh`, `.azure`, or an npm/vault config directory.
32- Review `process.executable`, `process.command_line`, and `process.parent.command_line` for `extensionHost` or a path under `.vscode/extensions` or `.cursor/extensions`.
33- Identify the extension id from that path and compare it with the installed extension.
34- On the same host and user, look for a preceding VSIX install, a suspicious shell spawned by `Code.exe` or `Cursor`, and outbound connections from the same process.
35
36### False positive analysis
37
38- Developer tools launched by the IDE can read `known_hosts` and `.npmrc`, or both `credentials` and `credentials.toml`, during normal git, npm, or cloud CLI use. Confirm the process path and the two file names before excluding.
39- Scope exceptions to a known process executable, extension path, host, or user. Do not broadly exclude `Code.exe` or `Cursor`.
40
41### Response and remediation
42
43- If the access is unapproved, stop the process, uninstall the extension, and disconnect the host from networks that hold the exposed accounts.
44- Rotate the credentials in the opened files, including browser passwords, cloud tokens, SSH keys, and npm or vault tokens.
45- Hunt `Esql.file_names` and the process executable on other hosts.
46"""
47references = [
48 "https://www.mdsec.co.uk/2021/01/macos-post-exploitation-shenanigans-with-vscode-extensions/",
49]
50risk_score = 73
51rule_id = "f27228e4-0792-4681-a965-9937ed6e4e00"
52setup = """## Setup
53
54This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
55
56Setup instructions: https://ela.st/install-elastic-defend
57"""
58severity = "high"
59tags = [
60 "Domain: Endpoint",
61 "OS: Windows",
62 "OS: macOS",
63 "Use Case: Threat Detection",
64 "Tactic: Credential Access",
65 "Tactic: Persistence",
66 "Data Source: Elastic Defend",
67 "Resources: Investigation Guide",
68 "Rule Type: ES|QL",
69 "Platform: Windows",
70 "Platform: macOS",
71]
72timestamp_override = "event.ingested"
73type = "esql"
74
75query = '''
76FROM logs-endpoint.events.process-*, logs-endpoint.events.file-*
77 METADATA _id, _index, _version
78
79// Normalize sensitive filenames for case-insensitive matching.
80| EVAL sensitive_name = TO_LOWER(file.name)
81
82// Identify processes launched by VS Code or Cursor.
83| EVAL is_editor_spawn =
84 event.dataset == "endpoint.events.process"
85 AND process.parent.name IN (
86 "Code",
87 "Code.exe",
88 "Code Helper",
89 "Code Helper (Plugin)",
90 "code",
91 "Cursor",
92 "Cursor.exe",
93 "Cursor Helper",
94 "Cursor Helper (Plugin)",
95 "cursor"
96 )
97
98// Identify sensitive file-open events.
99| EVAL is_sensitive_read =
100 event.dataset == "endpoint.events.file"
101 AND MV_CONTAINS(event.action, "open")
102 AND sensitive_name IN (
103 "logins.json", "login data", "local state",
104 "signons.sqlite", "cookies", "cookies.sqlite",
105 "cookies.binarycookies", "token",
106 "credentials.db", "credentials", "credentials.toml",
107 "access_tokens.db", "accesstokens.json",
108 "azureprofile.json", "rdcman.settings",
109 "keepass.config.xml", ".npmrc", "auth.json", ".vault-token",
110 "application_default_credentials.json"
111 )
112
113// Retain editor-associated process events and sensitive file opens.
114| WHERE host.id IS NOT NULL
115 AND (is_editor_spawn OR is_sensitive_read)
116
117// Capture editor parent entity IDs as ancestry anchors.
118| EVAL editor_anchor_id = CASE(
119 is_editor_spawn, process.parent.entity_id, NULL
120 )
121
122// Share editor ancestor IDs within each host.
123| INLINE STATS
124 editor_anchor_ids = VALUES(editor_anchor_id)
125 BY host.id
126
127// Retain sensitive file opens with valid process identity and ancestry.
128| WHERE is_sensitive_read
129 AND process.Ext.ancestry IS NOT NULL
130 AND process.entity_id IS NOT NULL
131
132// Match file-opening processes to VS Code or Cursor ancestors.
133| EVAL editor_ancestor_ids = MV_INTERSECTION(
134 editor_anchor_ids, process.Ext.ancestry
135 )
136| WHERE editor_ancestor_ids IS NOT NULL
137
138// Require at least 2 distinct sensitive filenames per process.
139| INLINE STATS
140 unique_sensitive_files = COUNT_DISTINCT(sensitive_name),
141 Esql.file_names = VALUES(sensitive_name)
142 BY host.id, process.entity_id
143
144| WHERE unique_sensitive_files >= 2
145
146// Preserve event-level investigation context.
147| KEEP
148 @timestamp,
149 host.id, host.name, host.os.type,
150 user.name,
151 event.action, event.outcome,
152 file.name, Esql.file_names, file.path,
153 unique_sensitive_files,
154 process.entity_id, process.name, process.executable,
155 editor_ancestor_ids,
156 _id, _index, _version
157'''
158
159[rule.investigation_fields]
160field_names = [
161 "host.name",
162 "host.os.type",
163 "user.name",
164 "process.name",
165 "process.executable",
166 "file.name",
167 "file.path",
168 "Esql.file_names"
169]
170
171[[rule.threat]]
172framework = "MITRE ATT&CK"
173
174[[rule.threat.technique]]
175id = "T1552"
176name = "Unsecured Credentials"
177reference = "https://attack.mitre.org/techniques/T1552/"
178
179[[rule.threat.technique.subtechnique]]
180id = "T1552.001"
181name = "Credentials In Files"
182reference = "https://attack.mitre.org/techniques/T1552/001/"
183
184[[rule.threat.technique]]
185id = "T1555"
186name = "Credentials from Password Stores"
187reference = "https://attack.mitre.org/techniques/T1555/"
188
189[[rule.threat.technique.subtechnique]]
190id = "T1555.003"
191name = "Credentials from Web Browsers"
192reference = "https://attack.mitre.org/techniques/T1555/003/"
193
194[rule.threat.tactic]
195id = "TA0006"
196name = "Credential Access"
197reference = "https://attack.mitre.org/tactics/TA0006/"
198
199[[rule.threat]]
200framework = "MITRE ATT&CK"
201
202[[rule.threat.technique]]
203id = "T1176"
204name = "Software Extensions"
205reference = "https://attack.mitre.org/techniques/T1176/"
206
207[[rule.threat.technique.subtechnique]]
208id = "T1176.002"
209name = "IDE Extensions"
210reference = "https://attack.mitre.org/techniques/T1176/002/"
211
212[rule.threat.tactic]
213id = "TA0003"
214name = "Persistence"
215reference = "https://attack.mitre.org/tactics/TA0003/"
Triage and analysis
Investigating Multiple Credential Access by VS Code or Cursor IDE Descendant
A process whose ancestry includes Visual Studio Code or Cursor opened at least two different sensitive files. The files
include browser stores (logins.json, Login Data, Cookies), cloud and token files, and SSH or package-manager
secrets. One such file can be normal for a language server or CLI. Two or more in the same process is credential
harvesting behavior associated with a malicious extension or a prompt-injected agent.
Possible investigation steps
- Review
Esql.file_namesandfile.pathfor which stores were opened and whether the paths sit under a browser profile,.aws,.ssh,.azure, or an npm/vault config directory. - Review
process.executable,process.command_line, andprocess.parent.command_lineforextensionHostor a path under.vscode/extensionsor.cursor/extensions. - Identify the extension id from that path and compare it with the installed extension.
- On the same host and user, look for a preceding VSIX install, a suspicious shell spawned by
Code.exeorCursor, and outbound connections from the same process.
False positive analysis
- Developer tools launched by the IDE can read
known_hostsand.npmrc, or bothcredentialsandcredentials.toml, during normal git, npm, or cloud CLI use. Confirm the process path and the two file names before excluding. - Scope exceptions to a known process executable, extension path, host, or user. Do not broadly exclude
Code.exeorCursor.
Response and remediation
- If the access is unapproved, stop the process, uninstall the extension, and disconnect the host from networks that hold the exposed accounts.
- Rotate the credentials in the opened files, including browser passwords, cloud tokens, SSH keys, and npm or vault tokens.
- Hunt
Esql.file_namesand the process executable on other hosts.
References
Related rules
- Suspicious IDE Extension Installation from VSIX
- Suspicious Command Execution from Visual Studio Code
- Multi-Cloud CLI Token and Credential Access Commands
- LLM-Based Curl Activity Triage
- LLM-Based Wget Activity Triage