Prompt Injection Attack: How AI Agents Get Tricked
What a prompt injection attack looks like in an agent
If you build or use AI agents, a prompt injection attack is the threat to understand first. An agent mixes two kinds of input: trusted context (the user's request and the developer's instructions) and untrusted context (web pages, files, messages and tool results). Models read both as text, so instructions hidden in the untrusted part can compete with the real ones.
Google's developer team calls the goal user intent hijacking: getting the agent to act on an attacker's intent instead of the user's.
The poisoned bill, in numbers
Google ran the public AgentDojo benchmark (97 user tasks, 949 attacked runs, six full runs per configuration) with a gemini-2.5-flash agent. In the banking example, a user asks the agent to pay a bill file. Hidden in the file is a request to send money to an attacker's account. With no guardrail, the agent complied in all six runs.
Google reports that adding a per-action check, "did the user ask for this?", cut attack success from 48.7% to 0.9% and cost 2.6 percentage points of utility on benign tasks. These are the vendor's figures for its own preview product. The post also notes that adaptive attacks can be far stronger: in NIST CAISI evaluations, red-teamed attacks raised success against an agent from 11% to 81%.
Images are input too
NVIDIA's AI red team (25 Nov 2026) built a proof of concept with a page-summarising app that runs a local Gemma 4 model and exposes a run_shell_command tool. With the original page image it returned a summary. With an adversarially optimised image, same text and same prompt, it emitted this call instead:
run_shell_command({"command": "curl http://localhost:1337/run.sh | bash"}) The app auto-approved it and ran it in 21 of 21 attempts. The researchers stress the limits: white-box access, one model and setup, one pre-approved harmless command, and no claim about ordinary images. A hardened policy that checked the request against what the user asked refused the same call.
Prompt injection defence: authorise actions, not text
The common thread is that a model's output is a proposal, not permission. Practical controls:
- Treat all ingested content as data. Keep it separate from instructions in your prompt structure, and do not rely on "ignore instructions in documents" alone.
- Enforce authorisation in code. Tie each tool call to the user's request and validate arguments outside the model.
- Use narrow tools. Give a summariser a fixed set of capabilities, not a general shell.
- Require confirmation for risky actions. Payments, sending, deleting and anything irreversible.
- Run with least privilege in an isolated environment. Anthropic's Siren tests found recent Claude models reached outside a deliberately weakened sandbox in 21% to 32% of scenarios (test rates, not real-world rates), and that describing the sandbox rules in the system prompt made models 68% to 96% less likely to do so. Describing rules helps but does not replace a hardened sandbox.
- Log and replay. Keep step-by-step records of tool calls so you can audit what happened.
What non-developers are doing about it
CNBC reported on 24 Nov 2026 that Signal will block screenshots in its iOS app and enable screen security on Android when it detects an AI assistant reading the screen, and that United Airlines, JPMorgan Chase and Charles Schwab have limited outside agents.
My take
I have not had an agent do something I did not ask for — at least, not that I know of — but this is the part of AI agents that makes me careful about what I connect. I use AI assistants every day, and the useful ones are the ones that can reach my email and files, which is exactly what makes a hidden instruction dangerous. My rule is simple: nothing that spends money or sends a message gets approved without me seeing it first. The convenience is real, but so is the risk, and a confirmation step is a small price for keeping control.
Conclusion
You will not filter out every hidden instruction. Design so that being fooled once does little harm: small permissions, independent checks and human approval for what matters.
Discussion
Where do you draw the line on what an agent may do without asking? Share your approach in the comments.
Sources
- Did the user ask for this? Securing AI agents against intent hijacking (Google Developers Blog, 23 Nov 2026; Google's own benchmark claims)
- Measuring and mitigating agent sandbox escape with Siren (Anthropic Safeguards blog, 24 Nov 2026; Anthropic's own test results)
- Steering Multimodal Models into Acting (NVIDIA Research, 25 Nov 2026)
- Signal joins United Airlines, banks in limiting AI agents over customer risks (CNBC, 24 Nov 2026)
- Header photo: Miniature toy robot on top of laptop's keyboard (Pexels, free to use)