/

CVE-2026-44461

Severity:

HIGH RISK

(8.6)

OS Command Injection in Zed Remote Commands

CVE-2026-44461

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution on Remote Host

Severity:

HIGH RISK

(8.6)

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

Zed's SSH/WSL remote command handling previously constructed shell command strings using unquoted environment variable keys, allowing shell expansions embedded in those keys to be interpreted by the remote shell.

If an attacker can influence an environment variable key (for example through project terminal settings), they may trigger arbitrary command execution on the remote host under the victim user's account when a terminal is opened.

Affected context

The vulnerability manifests when Zed is used to open SSH or WSL terminals and constructs remote startup commands as a single shell command string.

In affected versions, environment variable keys are interpolated directly into a command that begins with exec env ... without quoting or validation.

This becomes risky in setups where environment variables or project terminal configuration can be partially controlled by less-trusted sources (such as shared project settings, templates, or synchronized workspace configs).

Exploit preconditions

  • Attack surface: Zed's SSH/WSL remote command invocation flow.
  • Required access: Ability to influence or set environment variable keys used by Zed for remote terminals (e.g., via project terminal settings or configuration files).
  • Trigger point: Opening a remote terminal session in Zed, which constructs and executes an exec env ... shell command on the remote host.
  • Why exploitation is possible: Environment variable keys are concatenated into a shell command without quoting or validation, so shell metacharacters and expansions (e.g., $(...), backticks) in the key are executed by the remote shell rather than treated as literal text.

Why this happens

The core issue is improper construction of shell commands with untrusted input, mapping directly to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

Instead of treating environment variable keys as data, the implementation embeds them into a shell command string without quoting or escaping, effectively allowing shell syntax within the keys to alter the behavior of the command.

Because shells interpret constructs like command substitution, backticks, and other metacharacters before launching the target process, any attacker-controlled key that includes such syntax can cause arbitrary commands to run under the victim user's context.

Potential impact

  • Execution of arbitrary commands on the remote host under the victim user's account.
  • Unauthorized access to files and data reachable by the victim user on the remote system.
  • Installation of backdoors or persistence mechanisms on the remote host.
  • Lateral movement to other systems reachable from the compromised remote environment.
  • Exfiltration or tampering with source code, credentials, or build artifacts stored on the remote machine.

General mitigation guidance

Since this vulnerability stems from command construction patterns, mitigations focus on treating all shell-adjacent data as untrusted by default:

  • Prefer APIs that bypass the shell and pass arguments as structured arrays rather than raw command strings whenever starting remote commands.
  • If shell usage is unavoidable, rigorously quote and escape all interpolated values, including environment variable keys and values, ensuring they are treated strictly as literals.
  • Validate environment variable keys against a conservative allowlist (e.g., alphanumeric plus underscore) and reject or sanitize keys containing shell metacharacters.
  • Limit where environment variables and terminal settings can be configured, particularly in shared project configurations, and clearly separate trusted from untrusted configuration sources.
  • Apply least-privilege principles on remote accounts so that even if a terminal initialization command is abused, its ability to damage the system is constrained.

How teams detect issues like this

Effective detection generally combines code-level review with configuration scrutiny:

  • Use static analysis or linters to flag string-built shell commands that interpolate configuration values, environment variables, or user-supplied data without quoting or escaping.
  • In code review, treat any occurrence of sh -c, backticks, or command substitution as a high-risk pattern and verify that every interpolated value is validated and safely encoded.
  • Introduce internal policies that prefer process-spawning APIs with explicit argument lists over shell-based invocation for internal tooling and developer workflows.
  • Periodically audit project and workspace configuration files (including terminal or environment settings) for unexpected shell syntax in environment variable names or related fields, especially in shared or synchronized configurations.

Sources

SourceLink
github.comgithub.com/zed-industries/zed/security/advisories/GHSA-63qj-jc2q-7hg5

Frequently asked

questions

It can be, depending on how environment variable keys are sourced. If an attacker can influence project terminal settings or shared configuration that Zed uses to construct remote commands, they can exploit the issue when a victim opens a remote terminal.

The attacker needs the ability to control or modify environment variable keys that Zed uses for remote sessions. This typically means write access to project settings, configuration files, or any mechanism by which Zed derives terminal environment configuration.

The safest pattern is to avoid building shell command strings with untrusted input altogether and instead use APIs that pass arguments as structured parameters. Where the shell must be used, strictly validate environment keys and values and apply robust quoting/escaping before they are embedded into command lines.

Adopt a defensive design policy that treats all configuration-derived values as untrusted, enforces strong validation for anything that reaches a shell, and favors non-shell process creation APIs. Combine this with automated checks and code review practices that flag dynamic shell command construction as a high-risk pattern requiring explicit security review.

Find out what's already
exploitable in your codebase.