Suspicious IDE Extension Installation from VSIX
Description
Detects installation of an IDE extension from a local VSIX ("--install-extension" with a ".vsix" path) when that path is in a staging directory, or the parent is a script host or installer. VS Code and compatible editors (Cursor, VSCodium, Windsurf) use this CLI to sideload extensions outside the marketplace.
Query · esql
FROM logs-endpoint.events.process-* METADATA _id, _version, _index
| WHERE MV_CONTAINS(event.category, "process")
AND MV_CONTAINS(event.type, "start")
AND TO_LOWER(process.command_line) LIKE "*--install-extension*"
AND TO_LOWER(process.command_line) LIKE "*.vsix*"
AND (
(
host.os.type == "windows"
AND (
TO_LOWER(process.command_line) RLIKE
""".*\\users\\public\\.*|.*\\appdata\\local\\temp\\.*|.*/users/public/.*|.*/appdata/local/temp/.*"""
OR TO_LOWER(process.parent.name) IN (
"mshta.exe",
"wscript.exe",
"cscript.exe",
"powershell.exe",
"msiexec.exe",
"pwsh.exe",
"node.exe",
"bun.exe",
"py.exe"
)
OR TO_LOWER(process.parent.name) LIKE "python*"
)
)
OR
(
host.os.type IN ("macos", "linux")
AND (
TO_LOWER(process.command_line) LIKE (
"*/tmp/*",
"*/var/tmp/*",
"*/private/tmp/*",
"*/dev/shm/*",
"*/users/shared/*"
)
OR TO_LOWER(process.parent.name) IN (
"osascript", "node", "bun"
)
OR TO_LOWER(process.parent.name) LIKE "python*"
)
)
)
| KEEP
_id,
_version,
_index,
data_stream.namespace,
@timestamp,
host.name,
host.id,
agent.id,
host.os.type,
user.name,
user.domain,
process.name,
process.parent.name,
process.command_line,
process.parent.command_line
Investigation fields
Pivot points the source recommends for triage.
host.namehost.os.typeuser.nameprocess.nameprocess.parent.nameprocess.command_lineprocess.parent.command_line
Implementation guide
This rule is designed for data generated by Elastic Defend, which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
Analyst notes
Investigating Suspicious IDE Extension Installation from VSIX
An IDE CLI (code, cursor, codium, or a compatible editor) was invoked with --install-extension against a
.vsix file. The VSIX path is under a staging directory (Users\Public, AppData\Local\Temp, /tmp,
/var/tmp, /private/tmp, /dev/shm), or the parent is a script host or installer rather than the editor itself.
Sideloading a VSIX is a known way to persist or gain execution through a malicious IDE extension.
Possible investigation steps
- From
process.command_line, extract the.vsixpath and the editor binary (code,code.exe,cursor,codium). - Review
process.parent.nameandprocess.parent.command_lineto see whether a script host (powershell,pwsh,mshta,wscript,cscript,msiexec,python*,py.exe,node,bun,osascript) launched the install. - Hash the VSIX and compare it with the extension the editor actually installed under
.vscode/extensionsor the equivalent Cursor or VSCodium extensions directory. - On the same host and user, look for follow-on child processes from the extension host, new outbound connections, and files written by the extension.
False positive analysis
- Extension development often installs a locally built VSIX from PowerShell, pwsh, Node, Bun, or Python, including from a temp directory. Confirm the VSIX path, publisher, and parent script with the developer before excluding.
- Scope exceptions to a known VSIX path, parent command line, host, or user. Do not broadly exclude
--install-extensionor the editor binary.
Response and remediation
- If the VSIX is unapproved, uninstall the extension, remove the VSIX, and restart the editor.
- Quarantine the VSIX, collect its hash, and hunt that hash and command line on other hosts.
- If a script host launched the install, investigate that parent for a downloader or installer and remove it.
- Rotate tokens or credentials the extension could have read from the user profile or workspace.