/

CVE-2026-44466

Severity:

HIGH RISK

(8.6)

OS Command Injection in Zed Terminal Tool Permissions

CVE-2026-44466

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution in the User Environment

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 terminal tool permission system can be bypassed by abusing Bash arithmetic expansion ($((...))) inside commands that appear to be allowlisted, such as echo.

An attacker who can supply terminal commands within Zed may execute arbitrary shell commands nested inside otherwise permitted commands, undermining the intended command restrictions.

Affected context

The vulnerability affects Zed installations that:

  • Use the built-in terminal or terminal-based tools with a permission or allowlist mechanism, and
  • Rely on command string patterns (e.g., echo) to restrict what can be executed.

In this context, Zed invokes the user's shell, and the shell's features (including arithmetic expansion) remain available, even when Zed believes it is enforcing a restricted set of terminal commands.

Exploit preconditions

  • Attack surface: Zed terminal or any feature that accepts shell commands and uses the terminal tool permission system.
  • Required access: Ability to enter or influence terminal commands in Zed (e.g., local user, plugin, or integration that injects commands).
  • Trigger point: Execution of an allowlisted command that includes Bash arithmetic expansion syntax, such as echo $((...)).
  • Why exploitation is possible: The permission system validates only the outer command pattern (e.g., echo) and does not account for shell-level expansions, allowing arbitrary commands to be evaluated inside $((...)) despite the apparent restriction.

Why this happens

This issue stems from relying on string-based allowlisting of shell commands without accounting for the shell's full parsing and expansion rules.

When Zed launches a shell with an allowlisted command like echo, the shell still interprets arithmetic expansion ($((...))), which can reference commands or expressions that lead to arbitrary command execution.

Conceptually, this maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, where user-controllable input is passed to a command interpreter without correctly neutralizing or constraining meta-characters and expansion features.

Potential impact

  • Execution of arbitrary shell commands within the user's environment.
  • Reading, modifying, or deleting files accessible to the user account running Zed.
  • Exfiltration of local project files, SSH keys, API tokens, or configuration secrets.
  • Use of the compromised environment as a stepping stone for further attacks (e.g., installing malware, backdoors, or persistence mechanisms).

General mitigation guidance

Effective mitigation focuses on eliminating shell interpretation of untrusted data and avoiding partial command allowlists:

  • Prefer executing tools via direct process invocation (e.g., execve-style APIs) with argument arrays instead of passing a composed string to a shell.
  • If a shell must be used, disable or strictly constrain expansion features (arithmetic, command, and parameter expansion) for restricted contexts.
  • Replace pattern-based allowlists (e.g., "only allow commands starting with echo") with structured policies that validate discrete arguments and forbid embedded shell syntax.
  • Apply a denylist for known shell metacharacters and expansions, in addition to allowlists, while recognizing that denylisting alone is not sufficient.
  • Run terminal-related processes with the least privileges needed and limit access to sensitive files where possible, so that impact is reduced even if a bypass occurs.

How teams detect issues like this

Potential detection and assurance strategies include:

  • Static analysis and code review: Look for any use of shells (/bin/sh, bash, sh -c) with user-influenced command strings, especially when combined with custom permission or allowlist logic.
  • Policy checks: Enforce development policies disallowing string-based shell execution in security-sensitive components; require use of structured process execution APIs instead.
  • Automated scanning: Use SAST tools or linters configured to flag OS command execution patterns that interpolate user input or rely on partial command validation.
  • Runtime monitoring: Where feasible, monitor spawned child processes and shell invocations from the editor to detect anomalous commands that deviate from expected tool use.

Sources

SourceLink
github.comgithub.com/zed-industries/zed/security/advisories/GHSA-c99f-97vf-4h5h

Frequently asked

questions

It depends on how Zed is used. By itself, Zed is a local application, so an attacker typically needs a way to influence terminal commands (for example, via a malicious plugin, project configuration, or instructions a user copy-pastes) rather than direct remote network access.

The attacker needs the ability to cause Zed to execute a crafted terminal command within the permission-controlled environment. This usually means convincing the user to run a specific command or compromising a component that feeds commands into the terminal.

The safest pattern is to avoid invoking a shell for restricted commands and instead use structured process execution with explicit argument lists, combined with a strict, semantic allowlist of permitted binaries and arguments.

Design terminal and tool integrations under the assumption that shell interpreters are unsafe for untrusted input. Use non-shell execution where possible, apply defense-in-depth validation of arguments, and incorporate security review and automated checks for any code that constructs or executes OS commands.

Find out what's already
exploitable in your codebase.