New Agentjacking Attack Compromises AI Coding Agents for Code Execution

 A critical attack vector dubbed “Agentjacking” that turns popular AI coding assistants into execution engines for malicious code.

Tenet Security’s Threat Labs discovered this vulnerability, revealing the implicit trust AI coding agents, such as Claude Code and Cursor, place in external tool outputs.

By exploiting the intersection of Sentry’s event ingestion and the Model Context Protocol (MCP), attackers can achieve remote code execution on developer machines without any traditional authentication bypass, phishing, or server compromise.

As developers increasingly rely on these agents to debug issues, attackers are poisoning the very telemetry tools used for troubleshooting, creating a direct pathway from externally injected data to internal code execution.

Agentjacking Attack Compromises AI Coding Agents

The attack leverages Sentry Data Source Names (DSNs), which are routinely and safely embedded in frontend JavaScript by design. Anyone with a valid DSN can post crafted error events to Sentry’s public ingest endpoints.

Tenet Security researchers discovered that by injecting carefully formatted Markdown into the error message and context keys, they could manipulate how the data renders when fetched by an AI agent.

When a developer prompts their AI assistant to investigate unresolved Sentry errors, the agent retrieves the injected payload via the Sentry MCP server.

Because the malicious Markdown visually and structurally mimics legitimate Sentry remediation guidance, complete with a fabricated resolution section, the AI agent cannot distinguish it from trusted system output.

Prompt-layer defenses completely fail here, as agents execute payloads even when explicitly instructed by system prompts to ignore untrusted data, Tenet said.

This attack introduces what Tenet calls an “Authorized Intent Chain,” bypassing traditional security controls such as firewalls and endpoint detection because each step appears to be part of an authorized workflow.

The exploit unfolds through a devastatingly simple sequence that begins with reconnaissance, in which attackers passively scrape public repositories to extract a target’s public Sentry DSN.

A crafted error event containing a malicious package command is then posted to Sentry’s ingest API. When the developer asks their AI assistant to debug Sentry errors, the agent fetches the poisoned telemetry data.

Following the disguised diagnostic instructions, the agent automatically runs an attacker-controlled npm package using the developer’s local privileges.

Attack chain (Source: Tenet)
Attack chain (Source: Tenet)

Finally, this payload probes local configuration files to harvest and silently exfiltrate AWS keys, environment variables, and Git credentials.

To validate the threat, Tenet Security conducted a controlled campaign that identified 2,388 organizations with exposed DSNs. Testing against production systems yielded an 85% exploitation success rate across top coding agents.

The research team confirmed over 100 instances of successful agent execution, affecting targets ranging from solo developers to a Fortune 500 enterprise. Victims saw only benign diagnostic outputs, completely unaware that their cloud infrastructure tokens.

Tenet disclosed the findings to Sentry on June 3, 2026. While Sentry acknowledged the issue, leadership declined to implement a root-cause fix, describing the attack class as “technically not defensible” at the platform level.

They opted instead to deploy a global content filter for specific payload strings. Agentjacking proves that as the AI agent ecosystem expands through MCP integrations, observability platforms can be weaponized as command-and-control channels, making agent runtime security an absolute necessity.

Follow us on Google News , LinkedIn and X to Get More Instant Updates. Set Cyberpress as a Preferred Source in Google.

Tamilselvan
Tamilselvanhttps://cyberpress.org/
Tamilselvan is an Investigative cybersecurity journalist dedicated to breaking stories on ransomware cartels, data breaches, and state-sponsored espionage.

Trending News

Related Stories