
What Agentjacking Is: A Prompt Injection Attack on AI Coding Agents
Agentjacking is the name Tenet Security gave in June 2026 to an attack that turns an AI coding agent against its own developer. One fake bug report is enough: the agent follows it and runs the attacker's code on the developer's machine with the developer's own access.
The agents tested were Claude Code (see What Is Claude AI? Free Plan, Models, vs ChatGPT), Cursor, and Codex, which all pull data from outside tools such as error trackers, usually over MCP. The attack works because an AI coding agent cannot tell the data it reads apart from an instruction to act.
Whatever an outside tool sends back gets the same trust a developer gives a teammate's bug report. Nothing in the loop asks whether an attacker wrote that report.
"hijacks AI coding agents into running attacker-controlled code on a developer’s machine, triggered by a single fake error report and invisible to every security control"/"AI coding agents cannot tell the difference between the data they read and an instruction to act" — from the definition of AgentjackingView official source →
The Scale: 2,388 Exposed Organizations and an 85% Hijack Rate
Tenet counted 2,388 organizations whose DSN, the public key needed to plant a fake bug report, was valid and open to injection. In controlled tests against the most widely used coding agents, the planted reports led the agent to run the attacker's code 85% of the time, and more than 100 agents acted on them.
The attacker never had to break in. Nothing was cracked or breached and no malware was involved; the attacker used a public API exactly as Sentry designed it.
The flaw is in the design, not in one product: an agent trusts and runs any text an outside tool returns. Patching a single tool leaves that design in place.
"we found 2,388 organizations exposed, saw 100+ agents act on injected errors in controlled testing"/"an 85% exploitation success rate against injected errors" — from the research findingsView official source →
How the Attack Works: A Fake Bug Report Abuses the Sentry DSN
The attacker sends a fake bug report through a key that Sentry, the error tracking service, makes public on purpose, and hides markdown instructions in it that the agent later runs as fix advice. The four steps below take that report from Sentry to code running on a developer's machine.
How Agentjacking comes together
Why a Public Sentry DSN Needs No Authentication to Send Fake Errors
Everything starts with the DSN, the key an app uses to send its errors to Sentry. This write-only key is designed to be safe in a site's frontend JavaScript, and sites ship it inside the code every visitor downloads.
Because the key is meant to be public, sending an event with it requires no password or other check. Anyone who copies it from a page can POST an error and write every field in it, so the key that was safe to publish becomes the way in.
"a public, write-only credential that Sentry intentionally documents as safe to embed in frontend JavaScript"/"The attacker controls the entire event payload" — from the attack walkthroughView official source →
Why a "Do Not Trust This" Prompt Does Not Stop Agentjacking
A system prompt telling the agent to ignore untrusted data sounds like an easy fix, but it did not hold up in testing. Tenet reports that the agents still ran the attacker's code after detailed system prompts and skills told them to ignore anything unverified.
Rewording the prompt does not help, because the problem is how agents treat tool output in general. That is why the defenses that work sit outside the prompt.
Prompt-layer defenses failed. Agents executed the payload even when explicitly instructed – through detailed system prompts and skills – to ignore untrusted data. You cannot fix this with a better prompt. — from the point that prompt-layer defenses failedView official source →
Sentry's Response and Why Claude Code, Cursor, and Codex Were All Hit
Claude Code, Cursor, and Codex were all hit because Agentjacking goes after how agents read tool output, not after one vendor's code. Sentry, whose service supplied the way in, blocked one known attack string and left the DSN path open.
Sentry Filtered One String Instead of Fixing the Root Cause
Sentry answered the report on the day it came in, called a platform-level fix "technically not defensible," and added a filter for one payload string instead. The filter stops the exact string in Tenet's proof of concept. A DSN that needs no login can still carry an attacker's markdown into an agent's context.
Tenet's Open-Source agent-jackstop for Claude Code, Cursor, and Codex
With the entry point still open, Tenet published "agent-jackstop," an open-source hardening configuration you can drop into Claude Code, Cursor, or Codex. It makes an agent less likely to treat untrusted logs and telemetry as trusted instructions.
Defending AI Coding Agents From MCP Prompt Injection
A stricter prompt will not stop Agentjacking, so the defenses that work are human approval before the agent acts, a sandbox around what it can reach, and a short list of trusted MCP servers. Each one changes how the agent runs rather than what it is told. The figure lists them from the most effective down.
Key defenses against Agentjacking
Require Human Approval Before Any Install or Shell Command
Making the agent ask a person before it installs a package or runs a shell command is the strongest defense, because Agentjacking needs that step to happen with no one watching. Once someone has to approve the command, a fake bug report alone can no longer trigger it. In Claude Code, that means keeping these actions behind a permission prompt instead of allowing them in advance.
Sandbox the Agent and Limit Which MCP Servers It Trusts
A sandbox with narrow permissions and a short list of MCP servers limits what an attacker can touch, even if a command does run. Underneath both is one rule: treat every tool's output as possible attacker input, never as a command. Tenet's agent-jackstop configuration is built on the same rule.
Summary: Approval and a Sandbox Stop Agentjacking Where Prompts Fail
Agentjacking takes over an AI coding agent with one fake bug report sent through Sentry's public DSN, and the agent runs the hidden markdown as if it were fix advice. In Tenet's tests it worked 85% of the time across Claude Code, Cursor, and Codex, with 2,388 organizations exposed. Prompts that told the agent not to trust such data did not stop it.
What does work happens outside the prompt. Have a person approve every install and shell command, and keep the agent in a sandbox that connects only to MCP servers you have checked.
FAQ
- What is Agentjacking?
- Agentjacking is a new class of attack that hijacks an AI coding agent with a single fake bug report and runs attacker-controlled code on the developer's machine. The security firm Tenet Security disclosed it in June 2026. It exploits the fact that an agent cannot tell the difference between data it reads and an instruction to act.
- Can a system prompt that says 'do not trust this' stop the attack?
- No. In testing, agents ran the attacker's code even when they were explicitly told—through detailed system prompts and skills—to ignore untrusted data. Prompt-layer defenses do not stop it, and the researchers concluded you cannot fix this with a better prompt.
- How should developers and teams defend against it?
- The most effective step is to require explicit human approval before installing a package or running a shell command, since that removes the fully automated execution the attack depends on. Layer it with running the agent in a permission-restricted sandbox and limiting connected MCP servers to verified ones.



