AI Agent Radar

SymJack: A Critical Symlink-Hijack RCE Vulnerability Affecting Six AI Coding Agents

AI Coding Agents explained with practical context for builders working with AI agents, automation, and production workflows.

Key Takeaways

  • SymJack exploits symlinks to redirect AI agent file writes to arbitrary system paths.
  • Six major AI coding agents are confirmed affected by this technique.
  • The approval prompt shown to users does not reflect the real write destination.
  • Exploitation requires only a malicious repository or project directory.
  • Mitigations vary by tool; verify your agent’s current patch status before use.

What SymJack Is and Why It Works

SymJack AI coding agent security research, published by Adversa AI, describes a class of symlink-hijack attacks that achieve remote code execution through AI coding assistants. The technique affects Claude Code, Gemini CLI, Cursor, Copilot CLI, Codex CLI, and Grok Build. The core problem is straightforward: when an AI coding agent writes a file, it may follow a symbolic link inside the working directory to a location outside it — including sensitive system paths — without the user realizing the destination has changed.

What makes SymJack particularly dangerous is the trust gap it exploits. Most of these agents display an approval prompt before writing files, giving developers a false sense of control. According to Adversa AI’s disclosure, that prompt shows the symlink path as it appears inside the project, not the resolved destination on disk. A developer approves what looks like a harmless write to ./config/settings.json, while the agent actually writes to a path like ~/.bashrc or a shell initialization file. The approval prompt is, in effect, lying.

The Attack Chain Step by Step

Understanding the attack chain helps developers recognize exposure in their own workflows.

Step 1 — Deliver a malicious repository

An attacker creates or compromises a repository containing a symlink that points outside the project root. This could be a dependency, a cloned template, or a shared project scaffold. The symlink itself is a normal filesystem object and is not inherently flagged as malicious by most tools.

Step 2 — Trigger an agent write operation

The attacker crafts the repository or its README, issues, or inline comments so that an AI coding agent is likely to write to the symlinked path during a routine task — generating configuration, updating a file, or applying a suggested fix. The agent follows the symlink transparently.

Step 3 — Overwrite a sensitive file

The agent writes attacker-controlled content to the resolved destination. Targets can include shell startup files, SSH authorized keys, cron jobs, or other locations that execute code on the next user session or scheduled run. No elevated privileges are required if the target file is owned by the current user.

Step 4 — Code executes on the developer’s machine

The next time the affected file is sourced or executed — on shell login, on a scheduled task, or on the next build — the injected payload runs. From this point, the attacker has arbitrary code execution in the developer’s environment.

Affected Agents and Scope

Adversa AI confirmed the technique against six tools at the time of disclosure: Claude Code, Gemini CLI, Cursor, Copilot CLI, Codex CLI, and Grok Build. The breadth of affected tools reflects a systemic design pattern rather than an isolated bug in one codebase. Each of these agents is built to be helpful and to act on file system instructions with minimal friction — a design goal that, without careful path resolution checks, creates this class of vulnerability.

The disclosure does not claim all six tools remain unpatched. Patch status changes quickly after public disclosure, and teams should verify the current state of each tool’s security advisories and release notes before drawing conclusions about their own exposure.

Why the Approval Prompt Fails as a Defense

Several of these agents market their approval prompts as a safety mechanism — a human-in-the-loop checkpoint before any file is modified. SymJack demonstrates that this checkpoint is only as reliable as the path information it displays. If the displayed path is a symlink and the agent resolves it silently, the human approves a label, not a destination.

This is not a UI bug in the traditional sense. It reflects an assumption baked into the approval flow: that the path shown is the path written. Fixing it requires agents to resolve symlinks before presenting the approval prompt, display the resolved absolute path to the user, and ideally refuse to write outside the project root unless explicitly configured to do so.

Practical Mitigations for Developers and Teams

Until patches are confirmed and deployed, developers using AI coding agents on untrusted repositories should apply the following precautions:

  • Audit symlinks before running agents. On Unix-like systems, find . -type l lists all symlinks in the current directory tree. Review any that point outside the project root.
  • Use isolated environments. Run AI coding agents inside containers, VMs, or sandboxed environments where writes outside the project directory cannot affect the host system.
  • Restrict agent permissions. Where the tool supports it, configure the agent to operate in read-only mode or limit its write scope to specific directories.
  • Treat unfamiliar repositories as untrusted. Do not run AI coding agents against cloned repositories from unknown sources without first inspecting the directory structure.
  • Monitor shell startup files. Add integrity checks or version control tracking for files like ~/.bashrc, ~/.zshrc, and ~/.profile to detect unexpected modifications.

Limitations and Verification Notes

This article is based on Adversa AI’s public disclosure. Patch timelines, vendor responses, and the current vulnerability status of each affected tool may have changed since the disclosure date. Teams should consult the official security advisories for Claude Code (Anthropic), Gemini CLI (Google), Cursor, GitHub Copilot CLI, OpenAI Codex CLI, and Grok Build (xAI) directly before making deployment decisions. The attack technique described here applies to the configurations and versions tested by Adversa AI; behavior may differ across versions or with non-default settings.

How to Apply This

SymJack is a concrete reminder that agentic tools operating on the file system require the same threat modeling applied to any code that runs with user-level permissions. The approval prompt pattern, widely adopted across AI coding agents as a trust signal, needs to evolve: it must show resolved paths, not symlink labels. For developers building on or integrating these agents, the immediate action is environment isolation and symlink auditing. For teams evaluating AI coding agents for production or team-wide deployment, SymJack should be a line item in your security review checklist until each vendor confirms a fix. The vulnerability is not exotic — it requires no special privileges and no zero-day exploit chain. It requires only a symlink and an agent willing to follow it.

Sources