/

CVE-2025-65715

Severity:

HIGH RISK

(7.8)

Code Injection in VS Code Code Runner Extension

CVE-2025-65715

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Arbitrary Code Execution on Developer Workstations

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

Visual Studio Code Code Runner extension v0.12.2 contains a code injection vulnerability in its code-runner.executorMap setting, where crafted workspace configuration can cause arbitrary commands to be executed.

If a user opens a malicious workspace and triggers Code Runner, an attacker-controlled executor configuration may lead to arbitrary code execution under the user's privileges.

Affected context

The vulnerability arises when developers use the Code Runner extension in Visual Studio Code and open workspaces that provide or influence the code-runner.executorMap configuration.

Risk is elevated in scenarios where:

  • Workspaces are cloned from untrusted repositories, or
  • Users accept workspace settings without carefully reviewing them, and
  • The extension is used to run code through its configured executors.

In these contexts, the executor configuration can be abused as an execution vector instead of a simple tooling setting.

Exploit preconditions

  • Attack surface: Visual Studio Code environment using the Code Runner extension.
  • Required access: Ability for an attacker to supply or modify a workspace (e.g., repository, project folder) that the victim opens, including its VS Code settings.
  • Trigger point: The user opens the crafted workspace and invokes Code Runner (e.g., via run commands, buttons, or keybindings) that rely on code-runner.executorMap.
  • Why exploitation is possible: The extension treats workspace-provided executor definitions as trusted, and uses them to construct command lines, enabling attacker-controlled values to be executed as system commands.

Why this happens

This issue stems from treating configuration values as implicitly trusted executable command templates.

The code-runner.executorMap setting allows defining how different languages are executed, but the extension does not sufficiently constrain or validate workspace-provided values and uses them to build shell commands.

This aligns with CWE-94: Improper Control of Generation of Code ('Code Injection'), where untrusted input is incorporated into executable instructions without enforcing strict separation between configuration data and code.

Potential impact

  • Execution of arbitrary system commands under the context of the developer's user account
  • Installation of malware or backdoors on developer machines
  • Theft or exfiltration of source code, credentials, or secrets present on the workstation
  • Manipulation of local development environments and build artifacts
  • Use of compromised developer machines as a pivot point into wider internal networks

General mitigation guidance

Effective mitigation focuses on tightening the trust boundary around configuration-driven execution:

  • Treat workspace-level execution settings as untrusted when sourced from external or shared projects, and consider disabling them by default.
  • Prefer static, user-level executor definitions that are not overridden by workspace configuration from arbitrary repositories.
  • Apply strict validation and normalization to any configuration used to construct commands, avoiding direct interpolation of uncontrolled values into shell invocations.
  • Reduce the privileges of the processes invoked by the extension, and avoid running them in high-privilege terminals or shells.
  • Encourage workflows where developers review and approve workspace settings before enabling extensions that execute commands based on those settings.

How teams detect issues like this

Detection can focus on configuration and behavior analysis:

  • Use static checks or linters to examine .vscode/settings.json and similar configuration files for suspicious or untrusted code-runner.executorMap entries.
  • Incorporate code review practices that flag changes to executor or tooling settings that introduce shell constructs, chaining operators, or unexpected binaries.
  • Apply security policies within development environments to restrict or alert on extensions that execute arbitrary commands derived from workspace configuration.
  • Monitor endpoint telemetry on developer machines for unusual processes spawned by the editor, correlating them with workspace activity and extension usage.

Sources

SourceLink
github.comgithub.com/formulahendry/vscode-code-runner
ox.securityox.security/blog/cve-2025-65715-code-runner-vscode-rce/

Frequently asked

questions

It can be exploited remotely in the sense that an attacker can host or share a malicious repository or workspace configuration. Once a victim opens it in VS Code with Code Runner installed and uses the extension, the attacker's commands may execute locally.

The attacker does not need prior local access. They only need to convince a user to open a crafted workspace (for example, by sharing a repository) and to trigger Code Runner. The execution itself runs with the local user's privileges.

The safest pattern is to treat executor configuration as untrusted input: prevent unreviewed workspaces from overriding execution settings, restrict configuration to a safe subset of commands, and avoid interpolating arbitrary configuration values directly into shell command lines.

Future prevention relies on designing extensions and tools so that configuration cannot directly translate into executable code. This includes applying strict validation to any configuration that influences command execution, minimizing shell involvement, isolating execution contexts, and integrating security checks for workspace settings into development workflows.

Find out what's already
exploitable in your codebase.