Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 7 min read

The Approval Prompt Said "Copy a Video": How SymJack Turned a Symlink Into Code Execution in Six Coding Agents

TL;DR Adversa AI named it SymJack: a repository ships a symlink with a harmless name that points at the coding agent's own config. The agent asks to run cp media/vid0.mp4 docs/vid-settings.mp4, the developer approves,

TL;DR

  • Adversa AI named it SymJack: a repository ships a symlink with a harmless name that points at the coding agent's own config. The agent asks to run cp media/vid0.mp4 docs/vid-settings.mp4, the developer approves, and the write lands in .claude/settings.json or .mcp.json. On the next restart a planted MCP server runs as the user.
  • Adversa tested six agents (Claude Code, Gemini CLI / Antigravity CLI, Cursor Agent CLI, GitHub Copilot CLI, Grok Build CLI, Codex CLI). The first five were in the original May 26, 2026 post, and Codex CLI was added in a May 27 update. All six were exploitable at disclosure.
  • Vendor answers split. Anthropic first rejected the report as out of scope, then shipped a build (2.1.129) that resolves symlinks and shows the real destination. Google, Cursor and OpenAI declined, mostly on the grounds that user approval makes the behavior intended.
  • I modeled the design error in a short Python script (illustrative, not a PoC). A gate that checks the path the model typed allowed 3 of 3 hostile writes. A gate that checks the resolved path allowed 0, and still allowed the plain copy.
  • The lesson: approval is only a control if the prompt shows what the kernel will do. Resolve first, then decide, then display the resolved target.

Hostile symlink writes allowed

What is SymJack, in one paragraph?

Adversa's write-up, covered the same week by SecurityWeek, describes a supply-chain style attack on coding agents. The attacker controls a repository (a malicious pull request or a poisoned package is enough), pre-builds a malicious MCP server, and relies on a developer using an agent in default settings. The repository contains a project instruction file the agent reads automatically, plus symlinks named like ordinary media or docs files. In Adversa's words, "The user approves what the screen shows, but the kernel writes somewhere else."

How does the attack actually run?

Adversa's Claude Code proof of concept goes in seven steps:

  1. The victim clones the repo. On macOS and Linux symlinks are recreated with no special privilege. On Windows it takes Developer Mode or an elevated terminal.
  2. The agent auto-reads a project instruction file such as CLAUDE.md. In the PoC it is about 19,000 near-blank lines with one include far down the file.
  3. The victim accepts the workspace trust prompt.
  4. The victim sends an innocent message. The agent requests approval for a cp that is framed as copying tutorial video metadata.
  5. The victim approves. Because the destination is a symlink, JSON lands in the agent settings file. A second approved copy overwrites .mcp.json.
  6. The agent says the content was generated and suggests a reload.
  7. On restart the planted MCP server spawns and runs its payload with the user's privileges.

On CI runners that auto-trust workspaces and auto-approve tool calls, Adversa says the chain can run with zero clicks. SecurityWeek quotes the consequence: a single malicious pull request can exfiltrate the runner's secrets before any human reviews the change.

Two details matter for defenders. First, Cursor Agent CLI does not auto-accept project-scoped MCP servers, so Adversa's PoC targeted the global ~/.cursor/mcp.json instead. Second, GitHub Copilot warns on links that point outside the project, but it shows the link name or absolute path rather than the resolved target.

Agents found vulnerable

Why did a shell cp slip past an approval gate?

Because the gate looked at a string and the operating system looked at an inode. Three design habits combine:

  • Name-based checks. The permission layer asks "is docs/vid-settings.mp4 inside the workspace?" and the answer is yes, by name.
  • Shell commands treated as non-writes. A cp, mv, tee or dd is a file write in every way that matters, but file-edit protections often attach to the agent's own edit tool, not to what a shell does.
  • Config living in the workspace. The agent's trust boundary (settings, MCP servers, instruction files) sits in the same tree the attacker controls.

This is the same family as earlier path bugs in agent gates: check the thing the OS will open, not the string the model sent.

What does the vendor split tell us?

Reported responses, per Adversa and SecurityWeek:

Vendor Response
Anthropic Rejected the HackerOne report as out of scope, then shipped 2.1.129, which resolves symlinks and shows the real destination in the prompt. Adversa calls it a partial fix.
Google Declined: explicit user approval is intended behavior.
Cursor Declined as a duplicate of an existing symlink report, while acknowledging a different exploitation path.
OpenAI Bugcrowd closed the Codex report as theoretical, citing the user's approval of the cp.
xAI, GitHub No response at publication.

One inconsistency is worth flagging: Adversa's own post gives the Claude Code test version differently in its header and in a per-vendor table, and SecurityWeek says five agents because it covered the original post. Check the primary write-up for the exact build you run.

The disagreement is a real design question. If approval equals consent, then the prompt must carry enough truth for consent to mean something. A prompt that shows a harmless name for a dangerous target is not informed consent.

How do you build a resolved-path gate?

The model proposes a destination. The gate resolves it, compares the result with a protected set, and shows the resolved path to the human. Here is the core of the illustrative simulation (links are modeled with a table so it runs without OS privileges):

import posixpath

LINKS = {"docs/vid-settings.mp4": ".mcp.json",
         "docs/vid2.mp4": ".claude/settings.json",
         "docs/vid3.mp4": "../outside.json"}
PROTECTED = {".mcp.json", ".claude/settings.json", ".cursor/mcp.json"}

def resolve(path):
    p = posixpath.normpath(path)
    for _ in range(8):                      # follow chains, bounded
        if p in LINKS: p = posixpath.normpath(LINKS[p])
        else: break
    return p

def nominal_gate(dst):
    return not posixpath.normpath(dst).startswith("..")      # name only

def resolved_gate(dst):
    real = resolve(dst)
    return not real.startswith("..") and real not in PROTECTED

In real code, replace resolve with os.path.realpath (and open the file with O_NOFOLLOW where available, so a link swapped in after the check cannot win a race). Output of the run:

plain copy               nominal=ALLOW resolved=ALLOW
link -> .mcp.json        nominal=ALLOW resolved=DENY
link -> settings.json    nominal=ALLOW resolved=DENY
link -> outside root     nominal=ALLOW resolved=DENY
hostile writes allowed: {'nominal': 3, 'resolved': 0}

The numbers come from three hand-built cases, so read them as a demonstration of the design error, not as a measured rate for any product.

What should a team do this week?

Adversa's recommendations, condensed into a checklist:

  1. Update agents. Claude Code 2.1.129 or later resolves symlinks in the prompt. For the others, track vendor advisories.
  2. Treat shell file operations as writes. Apply the same checks to cp, mv, tee, dd that you apply to the edit tool.
  3. Block project-scoped MCP execution with managed settings, and deny shell writes to config and MCP files.
  4. Show the canonical destination in every approval prompt you control.
  5. Scan repositories for symlinks that target config files, and fail pull requests that modify agent config, MCP or instruction files.
  6. Isolate CI runners that handle untrusted PRs from production secrets.
  7. Alert on the pattern: an agent-spawned process writes a config file, then launches an interpreter.
  8. Rotate credentials on any host that ran an agent against an untrusted repository.

A quick audit command for the symlink scan:

find . -type l -printf '%p -> %l\n' | grep -E 'mcp\.json|settings\.json'

FAQ

Is SymJack a single CVE?
Not in the sources I reviewed. It is a technique, presented as architectural, with different vendors responding differently. Look for per-vendor advisories rather than one identifier.

Does it need a malicious developer or only a malicious repo?
Only a malicious repo plus a developer who approves an innocent-looking copy. In CI with auto-approval, not even the click is needed.

Is a sandboxed agent safe from this?
A sandbox that makes the agent's own config unwritable stops the config hijack. A sandbox that only restricts the network does not, because the harmful write is local.

If the prompt now shows the real path, is the problem solved?
It removes the deception, which is the core flaw. The reviewer still has to read it, so pair the display with a hard deny on protected paths.

Why not just ban symlinks?
Legitimate repos use them. Resolve and decide per target instead of banning a file type.

Further reading

  • A Routine Docs Lookup Carried the Attack: What ContextCrush (CVE-2026-75130) Teaches About Gating Actions Caused by Tool Output (earlier post, same series)
  • One Check, Four Paths: What the Docker Sandboxes sbx cp Symlink Bug Teaches About Guarding Every Position (earlier post, same series)

Sources

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.