Summary
Zed IDE can be tricked into executing arbitrary system commands when a user opens a folder containing a malicious .git/config that abuses the core.fsmonitor Git configuration option.
An attacker who can convince a victim to open a crafted project directory in untrusted mode may achieve remote code execution on the victim's machine through this configuration-based command execution vector.
Affected context
The vulnerability occurs when Zed IDE interacts with Git repositories embedded in folders opened as projects.
It specifically affects workflows where:
- The folder contains a
.gitdirectory with a controlled.git/config - Zed uses Git features that honor the
core.fsmonitorconfiguration - The user opens an untrusted or externally supplied project folder (e.g., from a zip, cloned repo, sample project, or shared archive)
The risk is highest when users routinely open repositories from untrusted or semi-trusted sources without inspecting their Git configuration.
Exploit preconditions
- Attack surface: Local desktop environment via Zed IDE project-opening functionality.
- Required attacker capability: Ability to provide or influence a directory the victim will open in Zed (e.g., malicious repository or project archive) and control its
.git/config. - Trigger point: The victim opens the malicious folder in Zed; Git-related operations that respect
core.fsmonitorare invoked. - Why exploitation is possible: Zed implicitly trusts and executes behavior derived from Git configuration (
core.fsmonitor) without sufficiently constraining or sanitizing the commands or programs associated with that option, enabling command execution defined by the attacker-controlled.git/config.
Why this happens
The underlying issue stems from treating repository-local Git configuration as trusted execution configuration inside the IDE environment.
The core.fsmonitor Git option allows specifying a helper program for filesystem monitoring, and Zed's integration with Git fails to isolate or constrain this helper when it is defined in an attacker-controlled .git/config.
This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), because data from a configuration file effectively controls what command or executable is run, with insufficient validation, sandboxing, or separation of code and configuration.
Potential impact
- Execution of arbitrary commands under the context of the user running Zed
- Installation of malware, backdoors, or persistence mechanisms on the developer's workstation
- Exfiltration of source code, SSH keys, tokens, and other sensitive development credentials
- Lateral movement within the developer's environment or connected infrastructure
- Tampering with checked-out source code to plant supply-chain compromises
General mitigation guidance
Effective mitigation focuses on treating Git configuration as untrusted input when opening unknown projects and constraining any execution paths it can influence.
General defensive patterns include:
- Decouple configuration from execution: Avoid directly executing or honoring helper programs specified in local Git configuration when operating in "untrusted project" contexts.
- Restrict dangerous options: Maintain an explicit denylist or safelist for Git config keys that can trigger process execution (e.g.,
core.fsmonitor, hooks, helper commands) when working with untrusted repositories. - Sandbox external helpers: Where helper programs must be used, execute them in a heavily sandboxed or brokered environment with limited permissions and no access to arbitrary system resources.
- Apply least privilege: Run IDE-related helper processes with minimal privileges and privileges separated from the user's broader environment where feasible.
- Expose security modes to users: Provide clear "untrusted folder" semantics where all configuration-driven execution paths are disabled or heavily constrained by default.
How teams detect issues like this
Several approaches can help organizations and projects detect similar vulnerabilities:
- Code review focus: Inspect IDE–Git integration code for places where Git configuration values influence process execution, command-line construction, or environment setup.
- Static analysis patterns: Use tools or custom rules to flag code that:
- Spawns subprocesses based on configuration or repository contents
- Builds shell commands or command-line arguments from unvalidated strings
- Invokes Git helpers without checking trust level of the repository
- Policy enforcement: Introduce architectural rules that forbid direct execution of commands defined in repository-local configuration for untrusted workspaces; enforce these via automated checks in CI for IDE extensions or integrations.
- Security testing: Include test repositories with malicious
.git/configentries in security regression suites to ensure that opening them in the IDE does not produce code execution.

