Cognitive

Part 7 · Agentic AI Security

ASI01: Agent Goal Hijack

An attacker redirects what an agent is trying to achieve, turning its legitimate tools toward a new objective.

3 min readBuilds on AI Agents and Tool Use, LLM01: Prompt Injection

OWASP ASI01. This material is for defense. Only test systems you own or are authorized to test.

Injected content can quietly replace the objective an agent is pursuing.

What it is

Agents plan and carry out tasks autonomously, but they cannot reliably distinguish instructions from related content. Attackers can therefore manipulate an agent's objectives, task selection, or decision path through injected prompts, deceptive tool output, forged messages, or poisoned data.

A single-turn prompt injection changes one response. A goal hijack changes the direction of a whole sequence of actions.

How the attack unfolds

The agent keeps working competently. It is simply working for the wrong objective.

Figure 40.1. The agent keeps working competently. It is simply working for the wrong objective.

Typical paths

  • Indirect prompt injection in documents, web pages, or calendar invitations.
  • Deceptive tool output that tells the agent what to do next.
  • Forged agent messages that appear to come from a trusted peer.
  • Gradual manipulation across several interactions.

Real-world case

OWASP cites EchoLeak, in which hidden prompts in an email caused Microsoft 365 Copilot to exfiltrate data without user interaction.

Defenses

Comparing actions with the approved goal exposes a hijack.
  1. Treat natural-language input as untrusted. This includes documents, tool results, and retrieved content.
  2. Enforce least privilege. Limit the damage a changed goal can cause.
  3. Lock the goal. Define it explicitly and require approval to change it.
  4. Validate intent at run time. Compare each planned action with the original task.
  5. Require human approval. Use it for high-impact or goal-changing actions.
  6. Monitor behavior. Alert when an agent's actions drift from its baseline.

Common misconception

Common belief

"If each action looks legitimate, the agent is behaving correctly."

In practice

A hijacked agent often uses only approved tools. The harm is in why it uses them.

Key takeaways

  • Goal hijacking redirects an agent's objective or plan.
  • Each planned action should be checked against the approved goal.
  • Least privilege limits the harm of a changed goal.

Explore next