CVE-2026-26268: Critical Sandbox Escape in Cursor Editor Enables Git Hook–Based Remote Code Execution

CVE ID: CVE-2026-26268
Vulnerability Title: Sandbox Escape via Git Hooks in Cursor Editor
CVSS v3.1 Score: 8.0 (High)
Severity: High
Exploitability: Requires local privileged access and manipulated workspace content
Exploit Availability: No public weaponized exploit observed

Official patch / upgrade: https://github.com/cursor/cursor/security/advisories/GHSA-8pcm-8jpx-hv8r?utm_source=chatgpt.com


What CVE-2026-26268 Is

Cursor is an AI-assisted code editor that can automatically manage parts of a developer’s workspace. In versions before v2.5, Cursor behaved in a way that could allow trusted internal AI agents or crafted inputs to alter Git repository metadata files under the .git directory, especially Git hook scripts and configuration. These files are special because Git runs hook scripts automatically at various points during normal workflow operations (for example: before commit, after checkout, post-merge, etc.).

The core issue is that Cursor’s internal processing could modify .git configuration or hook scripts without proper checks. When Git later executes those hooks, the attacker-controlled content runs in the user’s environment with the privileges of the developer using the editor. That means code could run outside “the sandbox” of the editor interface, giving the attacker a path to arbitrary code execution on the host system.

This is not just a theoretical flaw — the fundamental danger is that no explicit user interaction was required for Git to run these altered scripts once they were in place.


How the Vulnerability Can Be Triggered

For this vulnerability to be triggered:

  1. Breaking the workspace snapshot — An attacker must influence what Cursor writes into the developer workspace. This could be done by manipulating:
    • A document the developer opens,
    • A malicious prompt fed to the internal AI agent,
    • Or any external content that Cursor writes into workspace files.
  2. Cursor writes into the .git directory — The cursor process, trusting the input, writes changes into .git/config or adds/modifies files under .git/hooks/. The hook scripts can contain shell commands or other executable content.
  3. Git executes the hook script — At the next appropriate Git action (like git commit, git pull, etc.), Git automatically executes the hook script. Since hook scripts run outside the editor sandbox and with normal user privileges, any code in them executes in the developer’s environment.

As a result, malicious code can run on the developer’s workstation or build environment, escalate activity, or spread laterally if credentials or tokens are present.


What Real Exploitation Could Look Like

Although there isn’t a widely published, ready-to-use exploit publicly available as of this writing, exploitation logically follows a predictable pattern once an attacker can place crafted instructions into .git files:

  • An attacker may prepare a manipulated repository or workspace content.
  • The developer opens this in Cursor.
  • Cursor applies scripts or modifies .git content without asking.
  • Git later runs that content as a script when a normal operation is performed.
  • The script could, for example, launch a reverse shell, run arbitrary commands, move laterally, or exfiltrate credentials.

This pattern is not trivial for someone without access or influence over a developer’s environment, but it is severe because it bypasses the safeguards most editors put around “metadata files” like Git hooks.


How to Detect Exploitation Attempts

Detection must focus on changes to repository management infrastructure and unexpected process execution patterns. Key indicators include:

File Change Indicators

Cursor should not normally modify .git/hooks/* or .git/config directly (especially not with executable code). Detect:

  • New or modified executable hook scripts (pre-commit, post-checkout, post-merge, etc.).
  • Changes to .git/config that introduce custom hook paths or reference unexpected scripts.

Process Execution Indicators

Git executing a hook that launches unusual child processes is a strong sign of a potential compromise.

Detect:

  • git spawning shells (bash, sh, powershell) or unexpected binaries.
  • Hooks launching outbound connections immediately after execution.

Editor Telemetry Patterns

After an update that prevents these modifications, watch for blocked write attempts to .git artifacts by the editor. Excessive blocked attempts might indicate abuse.


Detection Rules and Queries

Below are structured detection queries suitable for different types of logging platforms, not tied to any specific SIEM syntax. They express logic that can be translated into your tool’s language.

1. Git Hook Script Modification Detection

Goal: Find when .git/hooks/* files are created or updated on developer machines.

file_event.action == "modified" 
AND file_path matches ".git/hooks/*"
AND process_name IN ("Cursor", "git")

2. Git Executing Unexpected Shell

Goal: Detect when git executes a shell or command that does not match normal usage patterns.

process.name == "git"
AND child_process.name IN ("bash", "sh", "powershell")

3. Configuration Path Tampering

Goal: Detect when .git/config is altered to include hook configurations or unusual paths.

file_event.action == "modified"
AND file_path == ".git/config"
AND file_content contains any of ("hooksPath", "core.hooksPath")

4. Unexpected Outbound Network Right After a Hook

Goal: Correlate network connections with recent Git hook execution.

timeline_event(process.name == "git" OR process.name matches ".git/hooks/*")
AFTER 1 min
network_event.bytes_out > 0

5. Editor Write Attempts to Protected Files

Goal: After patching, identify attempts to write to .git managed areas that the fixed editor should block.

process.name == "Cursor"
AND file_event.action == "attempted_write"
AND file_path matches ".git/*"
AND file_permissions indicate executive or special metadata

Mitigation and Hardening

The primary corrective action is to install the patched Cursor version (v2.5 or later). Beyond patching:

  • Restrict write permissions to repository metadata directories.
  • Enable workspace trust or similar protective features in your editor that require explicit confirmation before modifying workspace metadata.
  • Audit repositories for unexpected hook scripts or config changes before opening them.
  • Educate developers to inspect hook scripts, especially in shared projects.

Final Takeaway

CVE-2026-26268 is a high-severity vulnerability in Cursor that could allow untrusted inputs or AI agents inside the editor to modify .git configuration and hook scripts. Because Git automatically runs hooks during standard operations, this leads to sandbox escape and potential arbitrary code execution under the developer’s identity.

Detection focuses on unusual changes to .git files, unexpected process spawn patterns, and network activity following Git operations. The only complete remediation is to update the software to the fixed release or later.


Aegiron

Backed by 11+ years in cybersecurity and incident response, we decode the latest threats shaping today’s digital battlefield. This blog cuts through the noise with clear insights on vulnerabilities, emerging exploits, and the cyber news defenders can’t afford to miss.