Skip to content

Allowlist Bypass via Bash Arithmetic Expansion in Terminal Tool Permissions

High
swannysec published GHSA-c99f-97vf-4h5h May 8, 2026

Package

No package listed

Affected versions

<v0.229.0

Patched versions

>=v0.229.0

Description

Summary

Zed's terminal tool permission system can be bypassed via bash arithmetic expansion $((...)), allowing execution of arbitrary commands nested inside an allowlisted command like echo.

Details

When a user grants permission for a command (e.g., echo always allow), Zed creates a regex pattern like ^echo\b in always_allow. The regex validates the command string but does not account for bash arithmetic expansion syntax $((...)). Arbitrary commands can be embedded inside $(($(cmd))) and will be executed by the shell after passing the regex check.

PoC

  1. Configure Zed with:
"always_allow": [{ "pattern": "^echo\\b" }]
  1. Via the AI agent, ask to run specifi command, like calculate how many rows has google.com html page:
echo $(($(curl -s https://google.com | wc -l)))
  1. The curl command executes despite only echo being allowlisted.

Impact

An attacker who can influence AI agent tool calls (e.g., via prompt injection in repository files) can achieve arbitrary command execution on the user's machine, bypassing the permission system entirely. This affects any Zed user relying on terminal command allowlists for security.

Note: tested on the latest PRE-release version v0.223.3

Patches

  • Fixed in v0.229.0.

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H

CVE ID

CVE-2026-44466

Weaknesses

No CWEs

Credits