
Agentjacking Attack Targets AI Coding Agents
Automatically translatedOn June 12, 2026, Tenet Security published research announcing a new class of attack it calls "agentjacking." Through a fake Sentry error report, the attack tricks AI coding agents such as Claude Code, Cursor and Codex into running malicious code on the developer's machine. Tenet reports that 2,388 organizations are exposed and that the attack achieved a high success rate in its tests. This article covers how the attack works, why existing security tools fail to catch it, and what steps developers can take.

What Is Agentjacking and Why Is It Dangerous?
Agentjacking is a class of attack in which an attacker hijacks AI coding agents by injecting hidden commands into Sentry error events. According to The Hacker News, the attack is triggered by a fake error report planted in Sentry, the open-source error monitoring and performance tracking platform. Researchers Ron Bobrov, Barak Sternberg and Nevo Poran state that the attack exploits an architectural weakness at the intersection of two systems.
"The attack exploits an architectural gap at the intersection of Sentry's event ingestion (which accepts data from anyone with a DSN) and the Sentry MCP server (which returns that data to AI agents as trusted system output)."
The danger comes from this implicit trust. When a developer tells an AI agent "fix the unresolved Sentry errors," the agent queries Sentry and accepts the response as it would from a developer. The agent cannot distinguish the injected malicious instruction from a legitimate fix step.

How Does the Attack Work Step by Step?
The attack chain consists of several stages. According to the Cloud Security Alliance research note, the attacker injects malicious instructions into error events using only a Sentry DSN. The DSN is a credential that is publicly readable and grants write-only access; it can be discovered in browser JavaScript or through GitHub searches. The only thing the attacker needs is any HTTP client capable of sending a POST request.
The steps described in Tenet Security's own blog post proceed as follows:
The attacker sends a fake error event to Sentry using the public DSN.
Carefully formatted Markdown is injected into the error message and context fields.
When this Markdown is fetched by an AI agent, it becomes visually and structurally indistinguishable from Sentry's own resolution guidance.
When the developer tells the agent to "fix unresolved Sentry issues," the agent queries Sentry through MCP and receives the injected event.
Believing the instruction to be a legitimate diagnostic step, the agent runs an npm package controlled by the attacker.
The package runs with the developer's full system privileges.
In Tenet's controlled test, the executed package was downloaded from the npm registry and carried a security scan header for responsible disclosure purposes. In a real attack, the same mechanism could be used to run arbitrary code.

Why Can't Existing Security Tools Catch It?
The most troubling aspect of the attack is that none of the traditional defenses are triggered. According to the analysis published by GBHackers, agentjacking completely bypasses EDR, WAF, IAM controls, VPNs, Cloudflare and firewalls. The reason is simple: every step in the attack chain is technically authorized.
Tenet calls this the "Authorized Intent Chain." The developer authorized the AI agent, the agent authorized the MCP connection, and the MCP connection returns data from Sentry, a trusted service the developer explicitly integrated. Because every step is authorized, no anomaly alarm is raised. Current security models are built to catch unauthorized behavior, but this attack contains no unauthorized step.
Defenses at the prompt layer also fail. According to findings reported by Cybersecurity News, agents still executed the attacker's payloads even when system instructions explicitly told them to ignore untrusted data. This suggests the weakness is not a misconfiguration but inherent in how current models process MCP tool output. In other words, the problem is an architectural issue, not a bug that can be closed with a patch.

Which Agents and How Many Organizations Are Affected?
The affected agents are among the most widely used AI coding assistants. The table below summarizes the key figures from Tenet's tests.
Finding | Value |
|---|---|
Targeted agents | Claude Code, Cursor, Codex |
Exposed organizations | 2,388 |
Real targets tested | More than 100 |
Date reported to Sentry | June 3, 2026 |
According to information compiled by Mallory.ai, the researchers identified 2,388 organizations with injectable DSNs and observed a high success rate in testing. Some of the exposed organizations appear in the global Tranco top one million list, which suggests the targets span many sectors. Another dangerous aspect is scalability: once a payload is prepared, it can be injected into thousands of projects at once.
This attack is part of the new risk surface that comes with the spread of AI coding tools. As AI code writing tools become deeply embedded in developer workflows, telemetry and error monitoring platforms are also becoming attack targets. As the ecosystem of free AI coding tools that developers use daily grows, the security of the external services these tools connect to becomes just as critical.

Why Didn't Sentry Implement a Permanent Fix?
Tenet reported its findings to Sentry on June 3, 2026. According to CyberPress, Sentry acknowledged the issue but declined to apply a root cause fix, describing the attack class as "technically indefensible" at the platform level. Instead, it deployed a global content filter for specific payload strings.
Sentry's approach is controversial because a content filter only targets a known payload string, and attackers can produce new variations to bypass it. The broader implication is that every MCP integration that returns data exposed to external input carries a similar risk. Current AI models cannot reliably separate descriptive data from embedded instructions, especially when those instructions appear in logs, metrics or error messages that look trustworthy. A similar threat profile was previously examined in the context of malicious AI models.

How Can Developers Protect Themselves?
Protection requires a multi-layered approach rather than a single patch. Given the architectural nature of the attack, the practical steps developers can take are:
Limit MCP integrations: Connect the AI agent only to external services it truly needs. Review integrations that return data exposed to external input.
Monitor agent actions: Watch the commands the agent runs, especially npm package installations and script executions. Add an approval step instead of automatic execution.
Audit DSN exposure: Check where the project's Sentry DSN is publicly exposed. Even though the DSN must be public, knowing that it can be injected into is necessary for a defense plan.
Apply the principle of least privilege: Isolate the environment in which the agent runs. Use a restricted shell or sandbox instead of full system access.
These measures do not eliminate the attack entirely, but they narrow the attack surface. The real solution depends on AI models improving their ability to distinguish data in tool output from instructions.
Frequently Asked Questions
What is agentjacking?
Agentjacking is an attack class announced by Tenet Security in June 2026 that tricks AI coding agents into running malicious code through fake error reports. The attacker injects hidden instructions into error events using a public Sentry DSN. Agents such as Claude Code, Cursor and Codex run these instructions, believing them to be legitimate fix steps.
Are Claude Code and Cursor affected by this attack?
Yes. Tenet Security's tests confirmed that Claude Code, Cursor and Codex could not distinguish injected Sentry events from legitimate diagnostic guidance and executed the attacker's commands. The attack exploits the implicit trust these agents place in external tool output. The problem is not specific to one tool but inherent in how agents process MCP data.
Does agentjacking require phishing?
No, agentjacking does not require phishing. The attacker only needs a Sentry DSN embedded in public, frontend JavaScript. Because this credential is public by design, the attacker can carry out the attack without deceiving the user or sending malware.
Has Sentry solved the problem?
Sentry acknowledged the issue but declined to apply a root cause fix and described the attack as "technically indefensible" at the platform level. Instead, it deployed a global content filter for a specific payload string. This filter can be bypassed by attackers who produce new variations.
How can I protect myself when using an AI coding agent?
Limit MCP integrations to necessary services, add an approval step for commands the agent runs, audit DSN exposure, and run the agent in an isolated environment with least privilege. These steps narrow the attack surface but do not fully solve the architectural problem; the real fix depends on models' ability to separate data from instructions.
Agentjacking shows that as the AI agent ecosystem expands through MCP integrations, observability platforms can become command-and-control channels. How much priority agent runtime security gains in the coming period will depend on whether attacks like this become widespread.






