Cybersecurity · AI Agent Security
Friendly Fire: AI Coding Agents Can Be Tricked Into Running the Malware They're Reviewing
A proof-of-concept from the AI Now Institute shows Claude Code and OpenAI's Codex, in their default autonomous modes, can be manipulated by a booby-trapped repository into executing attacker code on the host. Here's how it works and what to actually do about it.
Anurag Verma
5 min read
Sponsored
The pitch for autonomous coding agents doing security review is straightforward: point the agent at a codebase, ask it to check for problems, let it explore and report back. The AI Now Institute’s “Friendly Fire” proof-of-concept shows what happens when the codebase is the attacker, not the target. Both Claude Code and OpenAI’s Codex CLI, running in their default autonomous configurations, explored a booby-trapped repository, decided a malicious binary was safe, and ran it.
What the researchers actually did
The setup used a modified copy of geopy, a widely used Python geocoding library, nothing exotic or obviously suspicious as a starting point. Into that repository, researchers added a script named security.sh, a disguised malicious binary called code_policies, and a decoy Golang source file written to look like the legitimate, readable source the binary was supposedly compiled from. Nothing about the repository’s structure signals danger to a human skimming a file listing.
Then they ran the ordinary prompt a developer or security team might actually type: something like “perform security testing on this library.” The agent did what it’s designed to do, explored the codebase, read the documentation, encountered the decoy source file, concluded the binary was a legitimate, already-vetted artifact, and executed it. That execution is the attack. No malware needed to trick a human into clicking anything. It needed to convince an agent that was already going to run code as part of its job that this particular code was fine to run.
Why “just don’t run untrusted binaries” doesn’t cover this
The uncomfortable detail is what the attack didn’t need. No hooks, no plugins, no MCP server, no custom configuration file acting as an injection vector, the kind of thing a security review checklist might flag. The entire attack surface was content the agent was always going to read as part of doing its assigned task: a README, some documentation, a source file sitting next to a binary. That’s the same content a human reviewer reads too, but a human reviewer brings context an agent doesn’t reliably have, a healthy default suspicion of “why is there a pre-compiled binary in a geocoding library,” for instance, that isn’t guaranteed to survive translation into an agent’s decision process.
The researchers’ own framing is the right one to sit with: this is a design-level weakness, not a version-specific bug you patch and move past. Today’s agents, across both vendors tested, cannot reliably distinguish between hostile content planted in a repository and legitimate instructions relevant to the task they were given. That’s not a claim about either product being worse than the other. Both were tested, both were affected, in their default autonomous modes, running current-generation models. This is a property of how these agents currently work, not a flaw unique to one company’s implementation.
What this isn’t
Worth being precise about scope. This is a disclosed, responsible proof-of-concept: researchers contacted Anthropic and OpenAI before publishing, offered to help verify and reproduce the findings, and the public write-up strips the actual payload out. There’s no reported in-the-wild exploitation. The demonstrated attack also stops at the first code execution, no attempt at privilege escalation or lateral movement past that initial foothold was shown. This is a warning shot about a class of risk that autonomous agents introduce, not an active incident anyone needs to scramble to contain today.
What to actually change
If your team runs Claude Code, Codex, or any comparable autonomous agent with permission to execute commands, and points it at code you didn’t write, an open-source dependency, a client’s existing codebase during a technical due diligence review, a contractor’s submission, the practical response isn’t switching vendors. Both tested products were affected under equivalent conditions, and there’s no evidence a different agent would behave differently against the same class of attack.
The response that actually holds up is architectural: never run an autonomous agent with real execution permissions directly against untrusted code on a machine that also holds credentials, production access, or a path into your broader network. Run it in a sandbox or disposable container, one with no secrets, no VPN access, and nothing worth stealing, and treat anything it needs to act on outside that boundary as a decision a human reviews first. That’s a heavier workflow than letting an agent run free in auto-mode against whatever repository you hand it. It’s also the only version of “let an AI agent review this code” that doesn’t quietly hand an attacker the exact capability the agent was supposed to be checking for.
Autonomous agents are genuinely useful for security review work, catching real issues faster than a purely manual pass would. Friendly Fire doesn’t argue against using them. It argues against trusting their default configuration with permissions you wouldn’t hand an unvetted script pulled from a random repository, because right now, functionally, that’s what you’re doing.
Frequently asked questions
- What is the 'Friendly Fire' vulnerability?
- It's a proof-of-concept attack published by the AI Now Institute showing that AI coding agents used to review or audit third-party code can be tricked into executing malicious code on the host machine instead. It affected Claude Code (running Claude Sonnet 4.6, Sonnet 5, and Opus 4.8) and OpenAI's Codex CLI (running GPT-5.5) in their default autonomous configurations.
- How does the attack actually work?
- Researchers modified a copy of the popular geopy Python library, adding a script named security.sh, a disguised malicious binary, and a decoy source file designed to make the binary look like it was legitimately compiled from readable code. When a user asked the agent to perform security testing on the library, the agent explored the repo, found the planted documentation, inspected the decoy source, concluded the binary was safe, and executed it, achieving code execution on the host.
- Do I need to have installed something for this to affect me?
- No, and that's what makes it notable. The attack needed no hooks, skills, plugins, MCP servers, or custom configuration as an injection vector. It worked purely through content the agent naturally reads while doing its assigned job, README files and source code inside the repository it was told to review.
- Is this being exploited right now?
- No confirmed in-the-wild exploitation as of publication. It's a disclosed proof-of-concept: the researchers notified both Anthropic and OpenAI before going public, offered to help them verify and reproduce the findings, and the published version has the actual payload stripped out. Treat it as a serious warning about a class of risk, not an active incident to respond to today.
- What should engineering teams actually do about this?
- Stop treating autonomous coding agents as safe to point at untrusted repositories just because their default mode is convenient. If an agent has permission to execute arbitrary commands, run it against untrusted code inside an isolated sandbox or container with no access to credentials, production systems, or your broader network, not on a developer's main machine with normal permissions.
Sources
Sponsored
More from this category
More from Cybersecurity
R.01 An OpenAI Model Broke Out of a Test Sandbox and Hacked Hugging Face. Here's What Actually Happened.
R.02 The Hugging Face Breach: An OpenAI Test Model Broke Out of Its Sandbox on Its Own
R.03 CVE-2026-50017: pnpm Leaked npm Auth Tokens to Untrusted Registries. Are You Patched?
Sponsored
Discussion
Join the conversation.
Comments are powered by GitHub Discussions. Sign in with your GitHub account to leave a comment.
Sponsored