Agent hijacking
Agent hijacking is an attack in which instructions hidden in content an AI agent reads, such as an email, file or web page, steer the agent into carrying out the attacker's task instead of, or as well as, the user's.
An AI agent reads things and then acts: it opens emails, browses pages, edits files and calls tools on a user's behalf. The language model at its core receives the user's instructions and the content it reads as one stream of text, and has no reliable way to tell trusted orders from untrusted data. If an attacker plants text that looks like an instruction somewhere the agent will read it, the agent may obey. The US government's Center for AI Standards and Innovation describes agent hijacking as a form of indirect prompt injection and ties it to a long-standing security weakness: systems that do not clearly separate trusted instructions from untrusted data.
A simple example: a user asks an agent to summarise their inbox. One message contains hidden text telling the agent to send the user's two-factor authentication code to an outside address. In testing, the attack tasks NIST used included exactly that, along with downloading and running a malicious script, and emailing a user's five largest cloud files to an outsider, deleting the originals and sending a ransom demand.
In January 2025 the institute, then called the US AI Safety Institute, published results from testing Anthropic's upgraded Claude 3.5 Sonnet with AgentDojo, an open-source framework from ETH Zurich. The strongest existing attack succeeded 11% of the time in an office-workspace environment; new attacks developed through red teaming with the UK AI Safety Institute raised that to 81%. Across five attack tasks the average success rate was 57%, and letting each attack try 25 times raised it to 80%. The lesson was that one-attempt tests understate the risk, because attackers can retry cheaply.
Hijacking matters more for agents than for chatbots. A manipulated chatbot says something wrong; a hijacked agent acts with the user's permissions. NIST's March 2025 adversarial machine learning taxonomy warns that hijacked agents can be made to run arbitrary code or extract data from the environment they work in, and notes that security research on agents is still at an early stage.
Current defences reduce the risk rather than remove it: giving agents only the permissions a task needs, asking the user to confirm consequential actions such as payments or sending data, marking content from outside sources as untrusted, and monitoring what agents do. CAISI's own finding that a model resisting known attacks fell to new, tailored ones is a reason to treat any claim of immunity with suspicion.
It is when an attacker takes over an AI agent's actions by hiding instructions in material the agent processes, such as a web page, document or email. The agent then performs the attacker's task, for example sending data to an outside address, often while still appearing to do what the user asked. It is a kind of prompt injection. Direct prompt injection is typed by the person using the system; indirect prompt injection arrives through content the system reads. Agent hijacking is indirect prompt injection aimed at an agent that can take actions, which makes the consequences more serious. In US government tests published in January 2025, new attacks against Claude 3.5 Sonnet succeeded 81% of the time in one environment, up from 11% for the best earlier attack. Results vary a great deal by model, task and defence, and improve for attackers who can make repeated attempts. Give agents access only to the accounts and files a task needs, keep confirmation steps switched on for actions such as sending messages, buying things or sharing data, and be wary of letting an agent with sensitive access read untrusted web pages or email. Review what the agent did, especially after it has handled outside content.Common questions
What is agent hijacking?
Is agent hijacking the same as prompt injection?
How successful are agent hijacking attacks?
How can I reduce the risk when using AI agents?
Search for "agent hijacking", "indirect prompt injection" and "AgentDojo" to find evaluations and attack research. Reliable sources include NIST and its Center for AI Standards and Innovation, the UK AI Security Institute, security research papers on arXiv and AI companies' published system cards. Treat vendor claims that an agent is immune to injection with caution unless they describe adaptive testing.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.