/

CVE-2026-55607

Severity:

HIGH RISK

(8.8)

Path Traversal & Sandbox Escape in Claude Code Git

CVE-2026-55607

Analyzed

Vulnerability type

Category:

Path Traversal and Sandbox Escape

CWE:

CWE-22, CWE-59, CWE-78

Impact:

Local Code Execution Outside Sandbox

Severity:

HIGH RISK

(8.8)

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

A sandbox escape vulnerability in Claude Code's Git worktree handling allowed crafted repositories to create .git worktrees and traverse outside the intended sandbox, causing git directory confusion.

By combining symlink manipulation with git fsmonitor execution, an attacker could cause file overwrites in the user's home directory and achieve code execution outside seatbelt restrictions when a user ran Claude Code against a malicious repository.

Affected context

This vulnerability affects environments where Claude Code (versions 2.1.38 through 2.1.163) operates on cloned Git repositories within a supposed sandboxed worktree.

Risk emerges when users clone and open untrusted or attacker-controlled repositories that can influence worktree naming, symlink layout, and Git metadata, particularly on systems where Claude Code has access to the user's home directory and shell configuration files.

Exploit preconditions

  • Attack surface: Claude Code's Git worktree management and associated filesystem operations.
  • Required access: The attacker must convince a user to clone and run Claude Code against a malicious repository containing prompt injection and crafted Git metadata/symlinks.
  • Trigger point: Execution of worktree-related operations, including creation of a .git-named worktree and running git fsmonitor hooks within Claude Code's environment.
  • Why exploitation is possible: Inadequate validation of worktree names, path resolution, and symlink targets allowed navigation outside the sandbox and interaction with sensitive paths in the user's home directory.

Why this happens

The core issue stems from insufficient enforcement of directory boundaries and trust assumptions during Git worktree handling.

Path traversal and symlink attacks (CWE-22, CWE-59) were possible because Claude Code did not robustly normalize and constrain filesystem operations to a sandbox root, permitting .git worktrees and out-of-sandbox navigation.

Combined with the ability to trigger git fsmonitor execution and interact with shell configuration files, this also aligns with command execution risks (CWE-78), as untrusted repository content could indirectly influence commands executed on the host.

Potential impact

  • Attacker-controlled overwrites of files in the user's home directory (e.g., .zshenv or similar shell init files).
  • Code execution on the host outside Claude Code's seatbelt sandbox when the user next launches a shell or affected program.
  • Persistence via modified configuration or startup scripts.
  • Escalation of impact from a confined coding assistant context to the broader user environment.

General mitigation guidance

Effective mitigation focuses on strengthening sandbox boundaries and treating repository content as untrusted input.

Typical patterns include:

  • Strictly validating and constraining worktree names and locations to remain within a defined sandbox root.
  • Resolving and normalizing paths before use, rejecting any that escape the sandbox or interact with special directories such as .git in unexpected ways.
  • Hardening symlink handling by either disallowing certain symlink patterns in worktrees or verifying resolved targets remain inside trusted directories.
  • Isolating helper tooling (e.g., Git fsmonitor hooks) from user home directories and sensitive configuration, and running them with least privilege.
  • Applying defense-in-depth, such as explicit allowlists for writable paths and denying interaction with shell initialization files.

How teams detect issues like this

Detection typically combines code-level and behavioral approaches:

  • Static analysis or code scanning rules looking for unvalidated use of filesystem APIs, path concatenation without normalization, and operations that follow symlinks when interacting with user-controlled repositories.
  • Code review checklists that flag any logic permitting worktree or .git directory manipulation without explicit sandbox boundary checks.
  • Runtime monitoring for unexpected writes from Claude Code or its helper processes to home-directory configuration files (e.g., .zshenv, .bashrc, .profile) and other sensitive locations.
  • Policy-based enforcement requiring all repository operations to be scoped to a dedicated workspace directory, with automated tests that assert paths never escape the sandbox.

Sources

SourceLink
github.comgithub.com/anthropics/claude-code/security/advisories/GHSA-7835-87q9-rgvv

Frequently asked

questions

It is not a traditional remote exploit against a network service; exploitation relies on a user running Claude Code against a malicious repository. However, once a user opens such a repository, an attacker may achieve code execution on the local machine.

The attacker needs the ability to supply or influence the Git repository the user works with, typically by hosting or distributing a crafted repository and persuading the user to clone and use it with Claude Code. Direct shell access is not required.

The safest pattern is to enforce strict sandbox boundaries around all repository operations: validate worktree names and locations, normalize paths before use, reject any that escape the sandbox, harden symlink handling, and prevent helper tools from interacting with sensitive directories such as the home directory.

Treat repository content and filesystem structures as untrusted input, design sandboxed environments with explicit path validation and allowlists, regularly review interactions with .git and configuration files, and integrate automated checks (static analysis, tests, and code review policies) that flag potential path traversal, symlink, and command execution risks.

Find out what's already
exploitable in your codebase.