SymJack: Symlink-Angriff lockt Coding-Agenten in Konfigurations-Falle
Ein getarnter Symlink in einem Repository kann Coding-Agenten wie Claude dazu bringen, per harmlos klingendem Kopierbefehl ihre eigene Konfiguration zu überschreiben. Die Attacke wurde von Adversa AI getauft und lenkt Schreibzugriffe etwa in die settings.json oder mcp.json.
Der Bericht von Adversa, der in derselben Woche von SecurityWeek aufgegriffen wurde, beschreibt eine Supply-Chain-artige Attacke auf Coding-Agents. Der Angreifer kontrolliert ein Repository (ein bösartiger Pull Request oder ein vergiftetes Paket genügt), erstellt vorab einen bösartigen MCP-Server und verlässt sich darauf, dass ein Entwickler einen Agenten mit Standardeinstellungen verwendet. Das Repository enthält eine Projekt-Instruktionsdatei, die der Agent automatisch liest, sowie Symlinks, die wie gewöhnliche Medien- oder Dokumentdateien benannt sind. Mit den Worten von Adversa: "Der Benutzer genehmigt das, was der Bildschirm zeigt, aber der Kernel schreibt woanders hin."
Adversas Proof of Concept für Claude Code verläuft in sieben Schritten:
Auf CI-Runnern, die Workspaces automatisch vertrauen und Tool-Aufrufe automatisch genehmigen, kann die Kette laut Adversa ohne einen einzigen Klick ablaufen. SecurityWeek zitiert die Konsequenz: Ein einziger bösartiger Pull Request kann die Secrets des Runners exfiltrieren, bevor ein Mensch die Änderung überhaupt prüft.
Zwei Details sind für Verteidiger relevant. Erstens akzeptiert der Cursor Agent CLI keine projektbezogenen MCP-Server automatisch, weshalb Adversas PoC stattdessen die globale Datei ~/.cursor/mcp.json ins Visier nahm. Zweitens warnt GitHub Copilot bei Links, die außerhalb des Projekts zeigen, zeigt aber den Link-Namen oder den absoluten Pfad anstelle des aufgelösten Ziels.
Weil das Gate auf einen String schaute und das Betriebssystem auf einen Inode. Drei Design-Gewohnheiten kommen zusammen:
Dies ist dieselbe Familie wie frühere Pfad-Bugs in Agent-Gates: Prüfen Sie das, was das Betriebssystem öffnen wird, nicht den String, den das Modell gesendet hat.
Die gemeldeten Reaktionen, laut Adversa und SecurityWeek:
Eine Inkonsistenz ist erwähnenswert: Adversas eigener Beitrag nennt die getestete Claude-Code-Version in der Überschrift anders als in einer Tabelle pro Hersteller, und SecurityWeek spricht von fünf Agenten, da der ursprüngliche Beitrag abgedeckt wurde. Prüfen Sie den primären Bericht für den genauen Build, den Sie einsetzen.
Das Modell schlägt ein Ziel vor. Das Gate löst es auf, vergleicht das Ergebnis mit einer geschützten Menge und zeigt dem Menschen den aufgelösten Pfad an. Hier ist der Kern der illustrativen Simulation (Links werden mit einer Tabelle modelliert, damit sie ohne OS-Berechtigungen läuft):
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 ): # Chains folgen, begrenzt if p in LINKS: p = posixpath. normpath ( LINKS [ p ] ) else: break return p def nominal_gate ( dst ): return not posixpath. normpath ( dst ). startswith ( ".." ) # nur der Name def resolved_gate ( dst ): real = resolve ( dst ) return not real. startswith ( ".." ) and real not in PROTECTED Vollbildmodus aktivieren Vollbildmodus beenden In echtem Code ersetzen Sie resolve durch os.path.realpath (und öffnen Sie die Datei, wo verfügbar, mit O_NOFOLLOW, damit ein Link, der nach der Prüfung ausgetauscht wird, kein Race gewinnen kann). Ausgabe des Laufs:
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} Vollbildmodus aktivieren Vollbildmodus beenden Die Zahlen stammen aus drei handgebauten Fällen, lesen Sie sie also als Demonstration des Designfehlers, nicht als gemessene Rate für irgendein Produkt.
Adversas Empfehlungen, verdichtet zu einer Checkliste:
Ein schneller Audit-Befehl für den Symlink-Scan:
find. -type l -printf '%p -> %l\n' | grep -E 'mcp\.json|settings\.json' Vollbildmodus aktivieren Vollbildmodus beenden FAQ Ist SymJack ein einzelnes CVE? Nicht in den von mir geprüften Quellen. Es ist eine Technik, als architektonisches Problem präsentiert, mit unterschiedlichen Reaktionen der einzelnen Hersteller. Suchen Sie nach Advisories pro Hersteller statt nach einem einzigen Identifikator.
Benötigt es einen bösartigen Entwickler oder nur ein bösartiges Repo? Nur ein bösartiges Repo plus einen Entwickler, der ein harmlos aussehendes Kopieren genehmigt. In CI mit Auto-Genehmigung ist nicht einmal der Klick nötig.
Ist ein Agent in einer Sandbox davor sicher? Eine Sandbox, die die eigene Konfiguration des Agenten schreibschützt, verhindert das Hijacking der Konfiguration. Eine Sandbox, die nur das Netzwerk einschränkt, tut das nicht, da der schädliche Schreibvorgang lokal erfolgt.
Wenn der Prompt jetzt den echten Pfad anzeigt, ist das Problem dann gelöst? Es beseitigt die Täuschung, die der Kernfehler ist. Der Prüfer muss ihn dennoch lesen, kombinieren Sie die Anzeige also mit einem harten Deny für geschützte Pfade.
Warum nicht einfach Symlinks verbieten? Legitime Repositories verwenden sie. Lösen Sie stattdessen jedes Ziel auf und entscheiden Sie individuell, statt einen Dateityp zu verbieten.
Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.
Original (Englisch) anzeigen
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."
Adversa's Claude Code proof of concept goes in seven steps:
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.
Because the gate looked at a string and the operating system looked at an inode. Three design habits combine:
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.
Reported responses, per Adversa and SecurityWeek:
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 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 Enter fullscreen mode Exit fullscreen mode 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} Enter fullscreen mode Exit fullscreen mode 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.
Adversa's recommendations, condensed into a checklist:
A quick audit command for the symlink scan:
find. -type l -printf '%p -> %l\n' | grep -E 'mcp\.json|settings\.json' Enter fullscreen mode Exit fullscreen mode 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.