Summary
Claude Code's sandbox previously allowed sandboxed processes to create symlinks that pointed outside the designated workspace, and the unsandboxed host process would follow these symlinks when writing files.
Under those conditions, an attacker who can inject untrusted content into a Claude Code context and trigger sandboxed code execution could cause writes to arbitrary filesystem locations outside the workspace, potentially leading to code execution beyond the sandbox boundary.
Affected context
This vulnerability arises in environments where Claude Code is used to run code in a file-system sandbox tied to a workspace directory.
The issue manifests when:
- Sandboxed commands can create or manipulate symbolic links inside the workspace, and
- The unsandboxed Claude Code process later performs file writes to paths that may traverse those symlinks, and
- There is no explicit check that the resolved path remains inside the intended workspace boundary.
In this configuration, the logical trust boundary of the workspace is undermined by filesystem link resolution semantics.
Exploit preconditions
- Attack surface: Claude Code's sandboxed execution environment and the associated host application file operations.
- Required attacker capability: Ability to introduce untrusted content into a Claude Code context window and influence sandboxed code execution (for example, via prompt injection or compromised project content).
- Sandbox behavior: The sandboxed process can create symlinks that point to arbitrary locations outside the workspace directory.
- Host behavior: The unsandboxed Claude Code process subsequently writes to a path that resides under or traverses such a symlink without validating the final resolved path.
- Why exploitation is possible: The combination of (1) symlink creation inside the sandbox and (2) unchecked symlink following by an unsandboxed process breaks the intended sandbox isolation, enabling writes outside the workspace even though neither actor alone can do so directly.
Why this happens
The core issue is a mismatch between the logical workspace boundary and how the filesystem resolves symbolic links.
The sandbox permitted the creation of symlinks that referenced locations outside the workspace, while the unsandboxed portion of the application later wrote to paths within that symlinked subtree without resolving and revalidating the destination.
This aligns with:
- CWE-61: Untrusted Search Path / Uncontrolled Symlink Resolution, where symlinks are followed without appropriate restrictions or checks, and
- CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), in that the code assumes operations are confined to a directory but fails to enforce this when symbolic links alter the effective path.
Conceptually, the sandbox enforced access control at the string path level rather than on the resolved canonical path, allowing sandbox escape through symlink indirection.
Potential impact
- Arbitrary file creation or modification outside the intended Claude Code workspace.
- Overwriting of configuration files, scripts, or binaries that may later be executed, leading to potential code execution outside the sandbox.
- Tampering with application, build, or deployment artifacts on the host system.
- Corruption of user data or project files located outside the workspace directory.
- Facilitation of further privilege escalation if high-value or privileged paths are writable.
General mitigation guidance
Effective mitigation focuses on enforcing the workspace boundary on the resolved filesystem paths and treating all symlink-influenced paths as untrusted until proven safe.
Useful defensive patterns include:
- Canonicalizing paths (e.g., resolving symlinks) before file operations and verifying that the final resolved location resides within the intended workspace directory.
- Restricting or disallowing symlink creation and modification by sandboxed processes, especially for paths that might later be touched by unsandboxed components.
- Applying a strict "deny by default" policy for file writes originating from sandbox-driven operations, only allowing writes to a vetted allowlist of directories that cannot be redirected via symlinks.
- Separating privileges so that any component that can be influenced by untrusted content runs with minimal filesystem permissions and cannot directly perform sensitive writes.
- Designing sandbox boundaries around capabilities rather than just directory paths, considering how filesystem features like symlinks, bind mounts, and shortcuts affect isolation.
How teams detect issues like this
Detection and assurance efforts can focus on both code-level patterns and runtime behavior:
- Static analysis:
- Flag code paths where unsandboxed components perform writes based on paths originating from sandboxed or otherwise untrusted sources without canonicalization and boundary checks.
- Identify filesystem operations that do not validate the resolved path against the intended workspace or jail directory.
- Code review signals:
- Look for logic that assumes "under this directory == safe" without considering symlinks or mount points.
- Review any hand-rolled sandbox or workspace isolation logic that lacks explicit checks on resolved paths.
- Policy enforcement:
- Integrate linters or security checks into CI pipelines that enforce safe path-handling practices and prohibit direct writes based on unvalidated user- or model-influenced paths.
- Use host-level monitoring to detect unexpected file writes from developer tools or sandboxed environments to sensitive locations.
- Automated tools:
- Employ security scanners or SAST tools that include rules for CWE-22 and CWE-61, focusing on path traversal and symlink handling in codebases implementing sandboxing or workspace abstractions.

