CVE-2026-47287 Overview
CVE-2026-47287 is a relative path traversal vulnerability [CWE-23] in Microsoft Visual Studio Code. An unauthorized attacker can leverage the flaw over a network to tamper with files outside the intended directory. Exploitation requires user interaction, such as opening a crafted file or workspace. The vulnerability affects integrity but does not directly impact confidentiality or availability.
Microsoft published the advisory on June 9, 2026. The issue carries a CVSS 3.1 base score of 6.5. No public proof-of-concept code or in-the-wild exploitation has been reported at the time of publication.
Critical Impact
Successful exploitation enables an attacker to write or modify files outside the intended path, compromising the integrity of files on a developer's workstation.
Affected Products
- Microsoft Visual Studio Code (see the Microsoft Security Update CVE-2026-47287 advisory for affected build numbers)
Discovery Timeline
- 2026-06-09 - CVE CVE-2026-47287 published to NVD
- 2026-06-09 - Last updated in NVD database
Technical Details for CVE-2026-47287
Vulnerability Analysis
The vulnerability is a relative path traversal flaw classified under [CWE-23]. Visual Studio Code does not properly canonicalize or restrict file paths supplied through a network-reachable input. An attacker can craft input containing ..\ or ../ sequences that escape the intended working directory.
Because the attack vector is network-based and requires user interaction, exploitation typically involves a malicious file, workspace, repository, or extension content that the victim opens in Visual Studio Code. Once processed, the path handling logic resolves the traversal sequences against a trusted root and operates on files outside that root.
The CVSS vector indicates the impact is limited to integrity. The attacker cannot read sensitive data or directly crash the editor, but can overwrite, create, or modify files reachable by the Visual Studio Code process. On a developer workstation, that scope often includes source code, build scripts, configuration files, and extension storage.
Root Cause
The root cause is insufficient validation of user-controllable path segments before they are joined with a base directory. Visual Studio Code accepts relative paths and does not reject or normalize traversal sequences before file system operations.
Attack Vector
An attacker delivers a crafted project, archive, or document. When the victim opens the resource in Visual Studio Code, the editor processes embedded path references and writes content to attacker-chosen locations. Tampered build scripts or shell initialization files can lead to follow-on code execution under the developer's identity.
No verified exploit code is publicly available. Refer to the Microsoft Security Update CVE-2026-47287 advisory for product-specific technical details.
Detection Methods for CVE-2026-47287
Indicators of Compromise
- File writes by Code.exe or code to paths outside the active workspace directory, particularly into user profile, startup, or system locations.
- Modifications to shell profile files such as .bashrc, .zshrc, or Microsoft.PowerShell_profile.ps1 shortly after a workspace is opened.
- Newly created or modified files containing ..\ or ../ segments within archives, .vscode folders, or repository metadata.
Detection Strategies
- Monitor process telemetry for Visual Studio Code child processes spawning unexpected interpreters such as cmd.exe, powershell.exe, or /bin/sh following the opening of a new workspace.
- Alert on file integrity changes to developer configuration and autorun locations when correlated with recent Visual Studio Code activity.
- Inspect Git repositories and downloaded archives for path entries containing traversal sequences before they are opened.
Monitoring Recommendations
- Enable verbose endpoint logging on developer workstations and forward file create, modify, and rename events to a central analytics platform.
- Track Visual Studio Code version inventory across the fleet and flag hosts running builds released before the patch.
- Review extension installation events and clone activity from untrusted Git sources.
How to Mitigate CVE-2026-47287
Immediate Actions Required
- Update Visual Studio Code to the patched version published in the Microsoft Security Update CVE-2026-47287 advisory.
- Instruct developers to avoid opening untrusted workspaces, repositories, or archives until patching is complete.
- Enable Visual Studio Code Workspace Trust and require explicit confirmation before executing tasks or extensions from new sources.
Patch Information
Microsoft has released a security update addressing CVE-2026-47287. The fix is documented in the Microsoft Security Update CVE-2026-47287 advisory. Apply the update through the Visual Studio Code auto-update mechanism or by deploying the latest installer through enterprise software distribution.
Workarounds
- Restrict Visual Studio Code to opening workspaces from approved repositories and file shares only.
- Disable auto-loading of workspace settings and tasks until the patch is applied.
- Use endpoint controls to block writes by the editor process to sensitive paths such as user startup directories and shell profile files.
# Verify the installed Visual Studio Code version
code --version
# Enable Workspace Trust enforcement via settings.json
# {
# "security.workspace.trust.enabled": true,
# "security.workspace.trust.startupPrompt": "always",
# "security.workspace.trust.untrustedFiles": "prompt"
# }
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

