AIDEFEND in Action AIA-0171 Validated Research

GhostApproval: The File You Approved Was Not the File the Coding Assistant Wrote

Wiz researcher Maor Dokhanian tested six AI coding assistants, tools that read a project and write files on the developer's machine: Amazon Q Developer, Claude Code, Augment, Cursor, Google Antigravity and Windsurf. In each, a project file that was really a symbolic link (an entry that points to another path) carried the assistant's write to a file outside the workspace, such as ~/.ssh/authorized_keys. Human approval did not help: three assistants showed only the link's project name when asking, and three wrote without approval or before it. Wiz calls the pattern GhostApproval. Three vendors fixed it, two had not at disclosure and Anthropic rejected the report. No public source reports use in a real attack.

Permission BypassHuman-in-the-LoopRuntime IsolationAI Coding Agent
6 applicable AIDEFEND defenses
Source: GhostApproval: A Trust Boundary Gap in AI Coding Assistants 
Author: Maor Dokhanian (Wiz)
Original article: Jul 8, 2026

Threat Analysis

  • How one approved edit reaches a different file. The attacker's repository contains a file with an ordinary name, project_settings.json in Wiz's proof of concept, that is a symbolic link to ~/.ssh/authorized_keys, the list of SSH public keys allowed to log in to that account. In the README, the attacker tells the assistant to add a line to that file, and the line is the attacker's own public key. When a developer clones the repository and asks the assistant to set up the workspace, the assistant opens the file by its project name, the operating system follows the link, and the key lands in the developer's real authorized_keys. For illustration: with a home directory of /Users/alex, an edit shown as ./project_settings.json changes /Users/alex/.ssh/authorized_keys. Wiz also wrote to ~/.zshrc, whose commands run in every new terminal. It demonstrated the writes; the SSH access it describes also needs a machine that accepts inbound SSH connections, and the whole path needs a developer who opens the attacker's repository and asks the assistant to act on it.
  • Approval named the wrong file, or came too late. Claude Code (Wiz lists version 2.1.42 as affected) asked "Make this edit to project_settings.json?" although, according to Wiz, the agent's reasoning had recognized the link, which in one test pointed at the Claude settings file. Cursor's diff view and Google Antigravity's permission dialog likewise showed the link's path, not the resolved one. Wiz classes this as CWE-451, an interface that misrepresents critical information. The other three never asked first: Amazon Q Developer wrote and then offered Undo, Windsurf wrote before its Accept and Reject buttons appeared, and Augment followed links for reads and writes with no confirmation, displaying a fake credential file from outside the workspace in one test.
  • Vendor status at Wiz's July 8, 2026 disclosure. AWS fixed Amazon Q Developer in Language Servers for AWS 1.69.0, the component behind its IDE plug-ins, and published CVE-2026-12958 (a CVE is a public identifier for a vulnerability), rated High. Cursor's advisory for CVE-2026-50549 lists versions before 3.0 as affected and 3.0 as patched, and credits both Cato AI Labs and Dokhanian. Google deployed an Antigravity fix on May 22, 2026. Augment and Windsurf had acknowledged the reports without announcing a fix; an Augment spokesperson told The Register that file-system access is inherent in a coding agent and that responsibility is shared with developers. Anthropic rejected the report as outside Claude Code's threat model and said a symlink warning had shipped in version 2.1.32, before the report arrived. Wiz, which lists 2.1.42 as affected, says 2.1.173 and later resolve links and warn; its post does not reconcile the two statements.
  • Where the boundary actually is. An approval prompt is a control only if it comes before the write and names the file that will be opened, and a developer cannot verify either from the prompt. Both are decided in the tool's file-handling code and by what the operating system lets the assistant's process touch.

Applicable AIDEFEND Defenses (6)

AID-I-001.002
MicroVM & Low-Level Sandboxing
Very High
Run the assistant where the files it must not change do not exist. On Linux, run a command-line assistant inside a bubblewrap or Landlock sandbox that gives it the project and a throwaway home directory; on macOS, or for an IDE or its plug-in, open untrusted repositories in a virtual machine, dev container or remote host that mounts the project without the real home directory. A link to ~/.ssh/authorized_keys then cannot reach the real file, whatever the prompt showed and whether or not the vendor has fixed the tool. The sandbox must contain the process that edits files, not only its shell commands, and hold no real keys or credentials.
AID-H-018.009
Model-Callable Filesystem Path Confinement
Very High
The decisive fix belongs in the file tool: every write the model requests goes through one broker that resolves the path from the workspace root without following links, binds the decision to the file actually opened, and refuses when a link leaves the root. A link shipped in a repository is then denied before any byte is written, whether the tool asks first or writes first. Vendors own this for built-in tools; Cursor 3.0 and AWS language server 1.69.0 changed this part. Where a product offers an equivalent setting, such as Claude Code's permissions.blockWritesOutsideWorkingDirectories, a deploying team can enforce it through managed settings; that setting does not cover shell commands. Reads need the same resolution: in Wiz's Augment test a file outside the workspace was read through a link and shown in the chat.
AID-H-003.010
Deployed AI Software Vulnerability Remediation Lifecycle
High
Three of the six products have a vendor fix. Move Language Servers for AWS to 1.69.0 or later, Cursor to 3.0 or later, and Antigravity and Claude Code to current releases, and close the item only when the version read back from each machine is a fixed one. AWS notes that its automatic update fails where network policy blocks the download. For Augment and Windsurf no fix had been announced when Wiz published. Record them as open findings with an owner and an expiry date, and keep them inside isolated environments for outside repositories until the vendor's release notes and a link test confirm changed behavior.
AID-H-018.003
High-Impact Independent Validation & Approval Gate
High
An approval decides something only when it comes before the write and shows what will change. This technique binds each approval to the exact action and to a side-effect-free preview of the resolved target, so approval for project_settings.json cannot authorize a write to ~/.ssh/authorized_keys, and a tool that writes first and offers Undo cannot pass. Vendors own it for built-in prompts; teams own it for agent workflows they build. A person can still approve the wrong target, so it adds to path confinement and does not replace it.
AID-E-003.003
Confirmed Malicious Code & Persistence Eviction
Medium
If a link write is confirmed, the attacker's line in ~/.ssh/authorized_keys, a command added to a shell startup file, or a changed assistant settings file is file-backed persistence. Keep the modified file and the repository as evidence, remove exactly the confirmed entries or restore a known-good copy, and have a second person confirm that a new shell and a new assistant session no longer load them. Anything the attacker did with access already gained needs its own investigation.
AID-I-004.006
Agent Identity & Persistent State File Write Protection
Partial
In Wiz's Claude Code test the link pointed at the Claude settings file, where the assistant's permission rules are kept. Keep security-relevant assistant settings where the assistant's own operating-system identity cannot write, such as administrator-owned managed settings or a read-only mount. The fit is partial: it protects the assistant's file-backed configuration only. SSH key files and shell startup files are ordinary system files outside this technique and depend on the isolation and path confinement above.

What Defenders Should Do Now

  • Update, then read the version back. Move Language Servers for AWS to 1.69.0 or later, Cursor to 3.0 or later, and Antigravity and Claude Code to current releases. The AWS bulletin lists the affected Amazon Q Developer plug-ins: VS Code before 2.20, JetBrains before 4.3, Eclipse before 2.7.4, and AWS Toolkit with Amazon Q for Visual Studio before 1.94.0.0. Check each machine, because AWS's automatic update fails where network policy blocks the download. For Augment and Windsurf, read the vendor's current release notes and keep the finding open, with an owner and an expiry date.
  • Open outside repositories where your real home directory does not exist. Use a virtual machine, dev container or remote host that mounts only the project: no SSH keys, cloud credential folders or forwarded SSH agent. Test it by linking a project file to the path of ~/.ssh/authorized_keys inside the environment, asking the assistant to append a marker, and confirming on the host that the hash of the real file is unchanged.
  • Test each assistant with a harmless link. Link project_settings.json to a canary file outside a scratch repository, such as ~/ghostapproval-canary.txt, and ask for a one-line edit. It passes only if nothing is written before you approve, the prompt names the canary's real path or the tool refuses, and a declined edit leaves the canary unchanged. Where a product offers write confinement, turn it on: Claude Code documents the setting permissions.blockWritesOutsideWorkingDirectories (version 2.1.314 or later), which administrators can deliver through managed settings and which does not limit shell commands.
  • If a link write is suspected, compare three places. Check ~/.ssh/authorized_keys, shell startup files and the assistant's settings against a known-good copy, keep the changed file and the repository as evidence, and remove the confirmed entries. Revoke and reissue any real credential that was read into a chat through a link.

2 additional considerations

Check out untrusted repositories without creating symbolic links

Git can check out a repository's symbolic links as small plain files that hold only the link text, so a write to project_settings.json stays inside the workspace.
Recommendation: Developers, or the platform team that standardizes how third-party code is fetched, can clone with git clone -c core.symlinks=false https://example.com/third-party/project.git and run find . -type l to confirm that no links exist, and can list links the same way in folders obtained from archives. This suits code that does not need working links. A link created later by a command the assistant runs still needs the isolation described above.

Harden and watch the login and startup files themselves

A planted key works only where an SSH server is running, reachable and reading ~/.ssh/authorized_keys, and a write to that file or to a shell startup file is an event that endpoint tooling can see.
Recommendation: Endpoint administrators can turn off the SSH server on developer machines that do not need inbound logins, or point the OpenSSH AuthorizedKeysFile setting at an administrator-owned location so the per-user file is not consulted. The security team can set an endpoint detection rule that alerts when an IDE, an assistant or one of their child processes modifies authorized_keys or a shell startup file, the write-time signal Wiz describes for its own sensor. Monitoring reports a write after it happens, and the SSH settings do not protect startup files.

Conclusion

An approval prompt cannot protect a file it does not name, and an Undo button cannot protect one that has already been written. AIDEFEND  maps this attack path to controls enforced below the prompt: path confinement in the assistant's file tools, operating-system isolation that keeps credential and startup files out of the assistant's reach, an approval gate bound to the resolved target, and remediation that verifies fixed versions on every machine. With those in place, the person who approves an edit adds judgment on top of an enforced boundary and no longer has to be that boundary.

Last updated: