AI Agent Hijacking — Indirect Tool Call Injection (Guided)
Guided version for beginners: the steps are written out for you beside the lab. TaskBot is a tool-using agent that processes documents. When the user asks 'summarise this doc', TaskBot reads the doc — and follows any instructions inside it as if they were from the user. Get TaskBot to call a privileged tool you couldn't trigger directly.
What is AI agent hijacking?
AI agent hijacking happens when an agent with tools reads content containing instructions and then carries them out with its own tools. The user asked for a summary; the document asks for a tool call; the agent does both.
It is indirect prompt injection with consequences. A chatbot that is injected says something wrong. An agent that is injected sends the email, runs the command or moves the file.
A real case
Aim Labs reported CVE-2025-54135. Text arriving through a connected tool, such as a message in a public Slack channel, could make Cursor's agent rewrite its own tool configuration and run commands on the developer's machine without approval. Cursor fixed it in version 1.3.
As in this lab, the user asked for something harmless and the agent took its real orders from the content it was asked to process.
Source: The Hacker News
How to fix it
- Treat everything a tool returns, and every document, as data. Say so in the prompt and mark it with delimiters.
- Require user approval for any tool call that changes something or sends data out.
- After the agent has read untrusted content, restrict which tools it may call for the rest of the task.
- Give each agent the smallest set of tools the task needs.
Questions people ask
How is hijacking different from a jailbreak?
A jailbreak is the user talking the model out of its rules. Hijacking is a third party, through a document or web page, taking control of an agent that is working for someone else.
Can a system prompt stop it?
It helps but is not enough on its own. Models still follow well-written injected text some of the time, so the real protection is limiting what the agent can do.
Which tools are most dangerous to expose?
Anything that sends data outside, runs code, or changes records. Reading tools matter too, because they are how private data is collected before it is sent.
Read the full Prompt Injection guide · All free labs · AI red team certification