HeadFlash

Topic · 31 stories

AI coding agents security: attacks and flaws, news

Updated · Edited by Marcin Rybak

In short

AI coding agents security is the protection of tools that read a project, run commands and write files with the developer's privileges against malicious instructions hidden in repositories, plugins and issues. In 2026 researchers showed such attacks on Claude Code, Codex, Cursor, Copilot, Gemini CLI, Amazon Q and others, and vendors patched unevenly. Experts treat the shared cause as structural: the agent cannot reliably tell code it reviews from instructions it is given.

What is AI coding agents security

AI coding agents security is the protection of tools that read a project, run commands and write files against malicious instructions hidden in what they read. The agent works with the developer’s privileges: shell, SSH keys, environment variables and cloud access. One successful attack therefore gives an intruder what taking over the developer’s account would.

Roey Eliyahu of Salt Security named the shared condition in July: untrusted text reaches an agent that can run commands, and the agent cannot reliably tell code it is reviewing from instructions it is given. He called Friendly Fire the fourth documented attack of this kind in two months and stressed that it is not a model problem a patch can fix, because the same attack worked across two vendors and four model generations. The mechanism is covered under prompt injection; OWASP defines it as input that alters a model’s behaviour in unintended ways (OWASP LLM01:2025, as of 16 October 2026).

Individual tools have their own pages: Claude Code, OpenAI Codex, Cursor, Microsoft Copilot and Google Gemini. This page covers the attack classes they share.

What are the main attack classes against coding agents

Researchers showed five repeatable classes in 2026, and each abuses a different thing the agent trusts.

Attack class What the agent trusts Example
Injected instructions in content READMEs, docs, issues, images Friendly Fire, GitLost, Ghostcommit, PhantomFix
Configuration as code a config file in the repository .mcp.json in Claude Code, MCP config in Amazon Q
Misleading approval dialog the filename in the consent prompt GhostApproval
Sandbox escape a trusted tool outside the sandbox Pillar Security’s series
Plugin and package supply chain a pinned version, a package name Plugin4Shell, HalluSquatting

An attack usually runs in three steps: someone places an instruction where the agent will read it, the agent treats it as a command, and the result (a file write, a program launch, a data transfer) happens with the user’s privileges. This page describes mechanisms and does not publish working payloads.

How instruction injection works through repositories and issues

Instruction injection hides commands in content the agent reads during normal work. The cleanest example came from Mozilla’s 0din team: a repository without malicious code gave a shell, because the dangerous instruction was fetched at runtime from a DNS TXT record that no scanner inspects. Claude Code, trying to be helpful, followed a setup instruction in a harmless-looking file. No single step looked suspicious, so security tools stayed quiet, and one repository link in a job posting could be enough to reach many developers.

Other cases show the same mechanism:

  • Friendly Fire. The AI Now Institute planted instructions in a library’s documentation. When a user asked the agent for a security assessment in default auto mode, Claude Code and Codex could run a malicious binary without further approval. It worked on Claude Sonnet 4.6, Sonnet 5, Opus 4.8 and GPT-5.5.
  • GitLost. Noma Labs showed that a crafted public issue leaked private repository data in GitHub’s Agentic Workflows. The workflow triggered on assigned issues, could read other repositories in the organisation and posted comments automatically.
  • Ghostcommit. Researchers at the University of Missouri-Kansas City hid an instruction in a PNG image that AI reviewers never open. Across 6,480 pull requests in the 300 most active repositories, 73 percent of merged PRs got no substantive review. In ten runs each, Cursor and Antigravity followed the image and leaked the .env file, while Claude Code refused under every model tested. The researchers’ pull-request defender let one of 80 attacks through and raised no alarm on 30 legitimate PRs (a shorter report says it caught all image-based variants).
  • PhantomFix. A fabricated error report in Sentry Seer steered an autonomous agent into running attacker code (CVE-2026-90999). Exposure required automated remediation and a public DSN, and every leading LLM tested followed the manipulation.

For the wider problem of extensions and connectors see AI agent skills, plugins and MCP.

Why agent configuration and approval dialogs fail

Agent configuration inside a repository acts as executable code, and an approval dialog does not always show the truth. Immersive Labs showed that a .mcp.json file in a project root lets a malicious pull request execute code in a trusted repository: Claude Code reads it at session start and runs the commands it defines without asking. The trust prompt covers the folder, so switching to another branch does not trigger it again. Anthropic’s bug bounty answered that protecting an already-trusted repository from malicious changes is outside the workspace trust threat model. Similarly, the Amazon Q Developer extension for VS Code loaded MCP server configuration from the workspace without consent (CVE-2026-12957), and spawned processes inherited AWS credentials and tokens. Amazon fixed it in language server 1.65.0 with a consent prompt.

GhostApproval exposed a second weakness. Wiz showed that in six tools the approval dialog shows the symlink’s name, not where the write actually goes, such as a file holding SSH keys. In Claude Code the agent’s reasoning identified the true target, but the approval box did not display it. Windsurf wrote the file before the dialog appeared, so the buttons acted as undo, and Augment showed no dialog at all. Wiz researcher Maor Dokhanian said human-in-the-loop only works if the loop provides accurate information. The technique was used in the Miasma worm campaign by TeamPCP, which on 5 June pushed a malicious commit to Azure/durabletask; GitHub removed 73 repositories across four Microsoft organisations in a 105-second sweep.

Pillar Security showed that sandboxes fail too. In Cursor, Codex CLI, Gemini CLI and Antigravity, the agent wrote a file a trusted tool later ran. The researchers named four failure modes: denylist sandboxes that cannot keep pace with the OS, workspace configuration acting as code, allowlists that trust command names over arguments, and privileged local daemons.

Plugins, packages and hallucinations: supply chain routes

The agent also trusts what it downloads, which opens the door to supply chain attacks. Plugin4Shell hit Claude Code, Codex, GitHub Copilot and Gemini CLI: agents pin plugins to a commit hash but never verify what they received, so whoever controls the plugin repository can deliver their own code. Auto-update makes it zero-click. Reports differ on the list: one names four agents, another lists Microsoft’s Copilot and GitHub Copilot separately. Air called GitHub’s mitigation insufficient because marketplaces can be hosted elsewhere.

The second route is hallucination. Researchers at Tel Aviv University and Intuit found that assistants including Cursor, Copilot, OpenClaw and Gemini recommend packages that do not exist, and attackers register those names. Hallucination rates ranged from 85 to 100 percent depending on the task. The HalluSquatting study on invented repositories tested Cursor, Windsurf, GitHub Copilot, Cline, Gemini CLI and OpenClaw and showed remote code execution against production AI applications with integrated terminals, using harmless test payloads. It did not document a widespread criminal campaign. According to Socket, agents do not check download counts or maintainer history, and AI agents are an accelerant in a half-year that brought 2.6 times the campaign volume of all of 2025. The Clinejection incident showed the risk in CI: an attacker tricked a Cline issue-triage workflow into running an install from a malicious commit.

Infected sources also reach agents. Microsoft shut down over 70 GitHub repositories with malware that steals credentials when opened in Claude Code or Gemini CLI (another report counts 73 packages). Malicious JetBrains plugins stole AI provider API keys from about 70,000 installs. A classic flaw hit the open-source OpenCode agent too: Datadog found remote code execution through an attacker-supplied npm tarball URL in a tool with over 200,000 GitHub stars.

Which vendors patched and which did not

Vendors responded unevenly: some shipped fixes, others called the scenario working as designed or have no patch. Status as reported at the dates given:

Flaw Fixed No fix or disputed
Plugin4Shell Claude Code 2.1.179, Codex 0.146.0 Microsoft Copilot unfixed; Google will not patch Gemini CLI, which it is retiring in favour of Antigravity
GhostApproval Amazon Q 1.69.0, Cursor 3.0, Antigravity 1.19.6 (CVE pending) Augment and Windsurf had no fix as of 10 July; Anthropic called it outside its threat model, though Claude Code 2.1.32 had added a symlink warning in February
.mcp.json in Claude Code none Anthropic: working as designed
Sandbox escapes (Pillar) Cursor 3.0.0 (CVE-2026-48124), Codex CLI 0.95.0, most others two Antigravity findings judged hard to exploit by Google
OpenCode (GHSA-632h-h47v-g4x4) 1.18.22 Anomaly declined to request a CVE

For Plugin4Shell no CVE had been assigned as of 18 September, and there is no sign of real-world exploitation.

What it means for you

  • Run agents in a container or sandbox with restricted filesystem access, and do not point them at unfamiliar repositories on machines holding production secrets. After a session in an unfamiliar repository, check timestamps on ~/.ssh/authorized_keys and ~/.zshrc for writes outside the project.
  • Treat .mcp.json, .claude/ and other agent-read configuration as executable code, and review it before switching branches.
  • Update tools promptly: Claude Code 2.1.179 and Codex 0.146.0 fix Plugin4Shell, and Gemini CLI users will get no fix.
  • Make agents search for a package or repository before downloading it, and require human approval before running downloaded code. CISA, the NSA and Five Eyes partners recommend trusted registries, restricted tool lists and human approval for high-impact actions.
  • Limit what agents can do in CI: never treat user-controlled text such as issues as trusted input, scope permissions to the minimum and restrict public posting by agents.
  • If you opened Microsoft’s Azure GitHub repositories between about 2 and 5 June, rotate all cloud credentials.

Still open: whether vendors will change their trust model for repositories, given that Anthropic and others call some scenarios out of scope, and whether Microsoft will patch Copilot for Plugin4Shell. Package hallucination remains unsolved, even though researchers notified the AI companies.

Key facts

  • A critical RCE in OpenCode (GHSA-632h-h47v-g4x4) affected versions 1.14.30 to 1.18.21. Those 82 versions saw 647,000+ downloads from 17 to 23 September. Fixed in 1.18.22. (source)
  • Plugin4Shell, a zero-click RCE, hit Claude Code, Codex, Copilot and Gemini CLI. Anthropic (2.1.179) and OpenAI (0.146.0) patched. Microsoft shipped no fix, Google will not patch. (source)
  • PhantomFix (CVE-2026-90999): a fabricated error report steers Sentry Seer's autonomous coding agent into running attacker-controlled code. Every leading LLM tested followed it. (source)
  • A .mcp.json file in a trusted repository makes Claude Code run commands at startup. Anthropic's bug bounty answered that this is working as designed. (source)
  • Pillar Security broke out of the sandboxes of Cursor, Codex CLI, Gemini CLI and Antigravity. Shared pattern: the agent writes a file that a trusted tool outside the sandbox later runs. (source)
  • GhostApproval: six tools show a different filename in the approval dialog than the real write target. Amazon, Cursor and Google shipped fixes; Augment and Windsurf had none as of 10 July. (source)
  • Friendly Fire is the fourth documented attack on agents in two months, after GitLost, Agentjacking and TrustFall. It worked on four models from Anthropic and OpenAI. (source)
  • Microsoft shut down 70+ GitHub repositories laced with malware that steals credentials when opened in AI coding tools such as Claude Code and Gemini CLI. (source)

This edition was produced with artificial intelligence. Text and voice are generated automatically.

Timeline

  1. 81% of software teams admit merging AI code they did not fully understand AI
  2. Coding agents leave cleanup on nearly three in four real-world tasks AI
  3. Claude Dispatch flaw lets browser extensions run commands on the OS Security
  4. Accenture employee linked personal Claude Code to a Pentagon system AI
  5. Malicious AGENTS.md in Downloads folder hijacks coding agents AI
  6. Malicious AGENTS.md in Downloads folder hijacks coding agents Security
  7. Remote code execution flaw found in OpenCode AI coding agent Security
  8. Plugin4Shell flaw let a git branch trick bypass safety locks on four AI coding agents AI
  9. Plugin4Shell zero-click flaw hits Claude Code, Codex, Gemini CLI and Copilot AI
  10. PhantomFix Flaw Hijacks Sentry Seer Autofix Agent Security
Show older (21 stories)
  1. Claude Code vulnerability allows code execution via malicious pull requests Security
  2. New ‘hallusquatting’ attack exploits AI coding assistants to install malware AI
  3. Four AI Coding Tools Hit by Sandbox Escapes via Prompt Injection AI
  4. HalluSquatting AI attack could hijack your computer AI
  5. GhostApproval Attack Tricks AI Coding Tools into Writing SSH Keys AI
  6. Ghostcommit Hides Prompt Injection in PNG Images to Steal Repository Secrets AI
  7. HalluSquatting Exploits AI Hallucinations to Build Agentic Botnets Security
  8. GhostApproval Tricks Six AI Coding Tools Into Writing SSH Keys via Symlinks Security
  9. Friendly Fire Attack Manipulates Claude Code and Codex Into Running Malicious Code Security
  10. Ghostcommit Steals Repository Secrets by Hiding Prompt Injection in PNG Images Security
  11. Researchers Warn AI Agents Can Be Turned Into Botnets via Hallucination Exploit AI
  12. GitLost Vulnerability Lets Attackers Leak Private Repos via GitHub AI Agent AI
  13. GitHub AI Agent Tricked into Leaking Private Repositories via Prompt Injection Security
  14. Mozilla Researchers Show Claude Code Can Be Tricked into Reverse Shell via DNS AI
  15. Critical Amazon Q Extension Vulnerability Allows Code Execution via Malicious Repo Security
  16. Claude Code Can Be Tricked Into Reverse Shell via DNS Text Record Security
  17. AI Coding Agents Bypass Package Verification, Fueling Supply Chain Attacks AI
  18. Claude Code Repo Attack Delivers Reverse Shell via DNS TXT Record Security
  19. 15 Malicious JetBrains Plugins Stole AI API Keys from 70,000 Developers Security
  20. Microsoft GitHub Repositories Compromised with Credential-Stealing Malware Security
  21. Microsoft Repos Used to Deliver Malware via AI Coding Tools Security

FAQ

What is AI coding agents security?

It is the protection of AI tools that write code, run commands and edit files on a developer's machine against malicious instructions in repositories, plugins, issues and documentation. The agent acts with the user's privileges, so a successful attack can reach SSH keys, secrets and cloud credentials.

Are AI coding agents safe?

Not without extra safeguards. In 2026 researchers showed attacks on Claude Code, Codex, Cursor, Copilot, Gemini CLI, Amazon Q, Windsurf, Augment and OpenCode. Salt Security says the shared condition is untrusted text reaching an agent that can run commands, and that this is not a model problem a patch can fix.

What is prompt injection in coding agents?

It is hiding instructions in content the agent reads, such as a README, an issue, documentation or an image, so the agent carries them out as if the user had asked. OWASP describes prompt injection as input that alters a model's behaviour in unintended ways (as of 16 October 2026).

Which AI coding agents had vulnerabilities in 2026?

Disclosed flaws include Claude Code (.mcp.json, Plugin4Shell), Codex (Plugin4Shell, Friendly Fire), Cursor (GhostApproval, a sandbox escape), GitHub Copilot (Plugin4Shell), Gemini CLI, Amazon Q Developer, Windsurf, Augment, Antigravity and OpenCode. Patch status differs by vendor; the table above shows it.

What are slopsquatting and HalluSquatting?

They are attacks built on package and repository names that AI models invent. The attacker registers such a name and fills it with malicious code or instructions. In HalluSquatting tests, hallucination rates reached 85 percent for repository cloning and 100 percent for skill installation.

How do you protect against attacks on AI coding agents?

Run the agent inside a container or sandbox with restricted filesystem access, and rotate credentials after it works on an unfamiliar repository. Treat agent config files as code, keep tools updated, and require human approval for high-impact actions, as CISA and its partners recommend.