/

CVE-2026-46508

Severity:

HIGH RISK

(7.8)

Command Injection in Turborepo LSP VS Code Extension

CVE-2026-46508

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-77

Impact:

Local Arbitrary Code Execution

Severity:

HIGH RISK

(7.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A command injection vulnerability in the Turborepo LSP VS Code extension allowed shell commands to be constructed from workspace-controlled values such as settings and task names.

When the extension activated or executed tasks, crafted values could be interpreted by the user's shell, potentially leading to arbitrary command execution with the privileges of the local VS Code process.

Affected context

This vulnerability affects developers using the Turborepo LSP VS Code extension with codebases that define Turborepo-related settings and tasks under workspace control.

It manifests when the extension builds shell commands from dynamic values (e.g., workspace settings, task names) and passes them to the system shell using string-based execution.

The risk is present whenever a user opens or works in a potentially untrusted repository (for example, a cloned sample project or contribution) that can influence the extension's configuration or task definitions.

Exploit preconditions

  • Attack surface: Local development environment via the Turborepo LSP VS Code extension.
  • Required access: Ability to modify or control the workspace repository or its configuration (e.g., workspace settings, Turborepo task names, or project files).
  • Trigger point: Extension activation or execution of Turborepo tasks through the extension, causing shell commands to be constructed and run.
  • Why exploitation is possible: Shell commands are composed using string interpolation of untrusted workspace-controlled values and then executed by the user's shell, enabling injection of additional commands or arguments.

Why this happens

The core issue is the construction of shell commands via string concatenation or interpolation using values that are derived from the workspace and not treated as untrusted input.

Instead of invoking the Turborepo daemon and task runs through parameterized or API-based mechanisms, the extension built full command strings and delegated them to the shell, which interprets special characters, separators, and control operators.

This maps to CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), where user- or environment-controlled data is integrated into commands without robust quoting, escaping, or separation between data and executable logic.

Potential impact

  • Arbitrary command execution within the context of the local VS Code process.
  • Execution of malicious scripts or binaries present on the developer's machine.
  • Unauthorized access to local files and directories accessible to the user account.
  • Theft or modification of source code, credentials, API tokens, or configuration files stored in the development environment.
  • Use of the developer's machine as a pivot point for further attacks within the local network.

General mitigation guidance

Effective mitigation focuses on separating untrusted data from shell interpretation and reducing the trust boundary of workspace-controlled values.

Pattern-based mitigations include:

  • Avoiding shell-based string command construction for core operations; instead, use direct APIs or process execution functions that accept argument arrays and do not invoke a shell.
  • Treating all workspace-controlled values (settings, task names, paths) as untrusted and subject to strict validation, normalization, and whitelisting where feasible.
  • Applying robust escaping or quoting only as a secondary measure when shell usage cannot be avoided, ensuring that data cannot introduce additional commands or control operators.
  • Implementing least-privilege defaults for extensions and tools, assuming that project repositories may be untrusted, especially when opened from external or public sources.
  • Providing clear separation between configuration intended for execution and metadata, so that unexpected fields cannot be interpreted as part of executable command lines.

How teams detect issues like this

Detection efforts can focus on identifying command construction patterns and verifying that untrusted input never flows directly into shell commands.

High-level strategies include:

  • Using static analysis or linters to flag calls that invoke shells (e.g., generic exec APIs) with concatenated or interpolated strings, especially in VS Code extensions or other developer tooling.
  • Reviewing extension code paths that build command lines from configuration, ensuring all dynamic components are sourced from trusted locations or validated inputs.
  • Implementing internal code review checklists that explicitly ask whether any workspace- or user-controlled data is used in command execution or process spawning.
  • Enforcing security policies in CI/CD pipelines that detect known unsafe command patterns and require security review for new or changed execution logic.
  • Leveraging automated security scanners or SAST tools configured with rules for CWE-77 to highlight probable command injection sinks in JavaScript/TypeScript projects.

Sources

SourceLink
github.comgithub.com/vercel/turborepo/security/advisories/GHSA-5xc8-49mv-x4mm

Frequently asked

questions

Exploitation is local to the developer's environment, but it can be triggered simply by opening or working with a malicious or compromised workspace that controls Turborepo-related configuration consumed by the extension.

An attacker needs the ability to influence the workspace contents or configuration, such as providing a repository with crafted Turborepo settings or task names. They do not need direct access to the developer's machine beyond convincing the developer to open or use the affected workspace in VS Code.

The strongest fix pattern is to eliminate shell-based string command execution for extension operations and instead use safe APIs that separate executable paths from arguments. Any remaining dynamic input should be strictly validated and passed as structured arguments rather than embedded into a single command string.

Future prevention relies on designing extensions and tools under the assumption that project workspaces may be untrusted: avoid shell invocation where possible, enforce clear trust boundaries for configuration inputs, integrate security-focused code review, and adopt automated checks to detect command injection patterns before release.

Find out what's already
exploitable in your codebase.