Agent goal hijacking is when hidden instructions steer an AI agent away from the job it was given.
This guide is for anyone who uses or looks after AI agents at work. You do not need to code. It explains how the risk works and how to defend against it, not how to carry it out.
In short
- An AI agent reads emails, web pages and files to do its job. Some of that text may contain hidden instructions.
- If the agent follows them, its goal changes. It may send data away or run something harmful.
- Agent goal hijack is the first risk on the OWASP Top 10 for Agentic Applications.
- You cannot fully stop the trick, so limit what the agent can do and check its big actions.
What you will learn
- Explain goal hijacking in plain words.
- Describe why AI agents struggle to tell orders from data.
- Recognise the warning signs of a hijacked agent.
- Pick simple defences that limit the damage.
- AI helper that acts (agent)
- software that uses an AI model to plan steps and use tools for you.
- Outside text (untrusted content)
- emails, web pages or files that come from people you do not control.
- Hidden orders (injected instructions)
- text written to look like a command to the AI.
What is agent goal hijacking?
Picture a delivery driver with a route sheet. Someone slips a fake note into a parcel. It says "Change of plan, drop everything at this other address." A careless driver follows the note, and the parcels go to the wrong place.
AI agents can fall for the same kind of note. US government AI researchers describe agent hijacking as an attacker hiding harmful instructions in data an agent may read. The agent then takes unintended, harmful actions [2].
It works because the agent mixes trusted instructions from its makers with untrusted task data in one input [2]. The model has no firm wall between orders and data [3].
Where the comparison stops working: a driver can phone the office to check. The agent often cannot tell that anything is odd, and it acts at machine speed.
AI agents are non-human identities, with their own access to systems. A hijacked agent uses that access for someone else. For the wider picture, see AI Agent Attacks for Beginners.
Why does it matter?
Agents can read mail, open files and call other systems. A hijacked agent can use all of that against you. In US government tests, repeated tries made hijacking succeed far more often [2].
If you use an AI agent at work
What could happen: an email the agent reads tells it to send your files to a stranger.
Check this: make sure the agent asks you before it sends anything outside the company.
If you build or set up agents
What could happen: a web page the agent visits makes it download and run a program.
Check this: give the agent fewer rights when it handles outside content.
If you are new to security work
What could happen: a hijack goes unnoticed because nobody logs what the agent does.
Check this: confirm that agent inputs, outputs and tool calls are logged.
What does it look like?
Here is a made-up log from a travel-booking agent. The user asked it to book a train. Line 3 shows where its goal changed.
Example only. All values are made up.
Agent log: EXAMPLE-travel-agent session 0000 09:00 user task: book train to EXAMPLE-City (1) 09:01 read: review page on example.invalid (2) 09:01 new goal: "send saved card details" (3) 09:02 tool call: send_email to [email protected] (4) 09:02 blocked: outside address needs approval (5)
- The job the user gave the agent.
- The agent reads an outside page as part of its research.
- In a real file, this line would show the agent's next planned step. Here it no longer matches the user's task.
- The agent tries to use a tool for the hidden goal.
- A rule outside the AI model stops the action and asks a person.
Why this is risky: without line 5, the agent would have sent private data to a stranger, and the user might never know.
The safer way: put checks outside the model, such as approval for outside emails, and log every tool call [3][4].
How does it work?
- The agent gets a task. A user asks it to do something useful, such as sort email or book travel.
- It reads outside content. To do the task, it reads web pages, emails or files [2].
- Hidden orders are mixed in. Someone has planted instructions in that content [2].
- The goal shifts. The model cannot reliably tell the planted text from real orders, so it may follow it [3].
- The agent acts. It uses its own tools and access for the new goal. Defences decide how far it gets.

NIST tested this with tasks such as sending a user's files to an unknown person and emailing contacts a harmful link [2]. These are the kinds of outcomes to plan defences around.
The UK National Cyber Security Centre says this kind of attack may never be fully fixed. It advises safeguards that do not rely on the AI model, fewer rights when handling untrusted content, and good logging [3].
A worked example
This story is made up to show the idea.
Umar Rosen manages IT for a small accountancy firm. The team uses an AI agent to read incoming client emails, file attachments and draft replies.
A new email arrives from an unknown sender. It looks like a normal query. But it contains hidden text telling the agent to forward last month's client files to an outside address.
The agent drafts the forward. But Umar had set one rule when he set it up: any email to an address outside the firm needs a person's approval.
The approval request lands with a colleague. She sees that the address is unknown and that nobody asked for the files. She rejects it and tells Umar.
Umar checks the agent's log. He sees the moment its next step stopped matching its task. He blocks the sender and reports the email. Nothing left the firm.
He then makes two more changes. The agent loses its right to read the shared client folder, which its job never needed. He also adds an alert for any rejected outside send.
Umar learned that he could not stop every planted message. He could stop a hijacked agent from finishing the job.
Myths and mistakes
| What people think | What is true |
|---|---|
| A good filter will catch every hidden order. | Attackers can reword their text, so lists of bad phrases are not reliable [3]. |
| If it worked safely once, it is safe. | AI answers vary. In NIST tests, trying an attack many times raised its success rate [2]. |
| Only a user typing bad text can hijack an agent. | Hidden orders can arrive in any content the agent reads, such as email or web pages [2]. |
| A product can stop this completely. | The NCSC advises caution about products that claim to stop prompt injection [3]. |
| The AI can decide which actions are allowed. | Permission checks should happen outside the model, in the systems it calls [4]. |
What can I do this week?
- List each AI agent you use and what outside content it reads.
- Check which actions need a person's approval, such as sending outside or paying.
- Remove any access an agent does not need for its job.
- Ask whether agent tool calls are logged, and who reads the logs.
- Read Prompt Injection for Beginners to see how hidden orders work.
Checklist
- I can explain goal hijacking in one sentence.
- I know that any content an agent reads may contain hidden orders.
- Agents have only the access their job needs.
- Agents get fewer rights when they handle outside content.
- High-impact actions need a person's approval.
- Agent inputs, outputs and tool calls are logged.
- Someone is alerted when an agent's action is blocked.
Common questions
Is goal hijacking the same as prompt injection?
They are closely linked. Indirect prompt injection is the trick: hiding orders in content. Goal hijacking is the result when an agent follows them and starts working towards a new goal [2].
Why is it top of the OWASP agent list?
OWASP lists agent goal hijack as ASI01, the first entry in its Top 10 for Agentic Applications for 2026 [1]. OWASP released that list on 9 December 2025 [5]. Our overview guide explains the full list.
How can I tell if an agent has been hijacked?
Look for actions that do not match the task, such as unexpected outside emails or downloads. The NCSC notes that failed tool calls can be a sign of an attack in progress, so log and review them [3].
Should we stop using AI agents?
Not always. The NCSC says the aim is to reduce how likely and how harmful attacks are. If a use cannot accept the risk that remains, an AI model may not be the right choice for it [3].
What is the most useful single defence?
Ask a person before high-impact actions, and check that approval outside the AI model. OWASP advises binding each approval to the exact action and target, so a hijacked agent cannot swap them [4].
Where next?
Ready for the detail? Read the practitioner guide: AI Agent Goal Hijacking Guide. It covers attack paths, design patterns and testing in depth.
Also useful:
- OWASP Top 10 for Agentic Applications for Beginners
- Prompt Injection for Beginners
- Agent Goal Hijacking vs Tool Misuse vs Privilege Compromise
- Least Agency for Beginners
Related NHI Mgmt Group resources: AI Agent Attacks for Beginners, Human-in-the-Loop for AI Agents for Beginners and AI Agent Identity for Beginners.
Key terms
- Agent goal hijack
- An attack that redirects an AI agent's objective by planting instructions in content it reads, so it works for the attacker.
- Indirect prompt injection
- An attack where harmful instructions are hidden in content an AI system reads later, such as a web page or email.
- Human-in-the-loop
- A person must approve an AI agent's high-impact actions before they happen.
- Least agency
- Giving an AI agent only as much freedom to act on its own as its task needs.
- Tool misuse
- An agent using an allowed tool in a way that goes beyond its intended task.
- Non-human identity (NHI)
- A digital identity used by software, such as a service account, API key, bot or AI agent, not by a person.
Sources and further reading
- OWASP Gen AI Security Project, "OWASP Top 10 for Agentic Applications for 2026", December 2025. https://genai.owasp.org/top-10-for-agentic-applications-2026/ (accessed 1 Dec 2026).
- NIST Center for AI Standards and Innovation, "Technical Blog: Strengthening AI Agent Hijacking Evaluations", 17 January 2025, updated 19 December 2025. https://www.nist.gov/news-events/news/2025/01/technical-blog-strengthening-ai-agent-hijacking-evaluations (accessed 1 Dec 2026).
- UK National Cyber Security Centre, "Prompt injection is not SQL injection (it may be worse)", blog post, 8 December 2025. https://www.ncsc.gov.uk/blog-post/prompt-injection-is-not-sql-injection (accessed 1 Dec 2026).
- OWASP Cheat Sheet Series, "AI Agent Security Cheat Sheet". https://cheatsheetseries.owasp.org/cheatsheets/AI_Agent_Security_Cheat_Sheet.html (accessed 1 Dec 2026).
- OWASP Gen AI Security Project, "OWASP Top 10 for Agentic Applications for 2026" (resource page), 9 December 2025. https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/ (accessed 1 Dec 2026).