Lesson 8 of 10 · 14 min read
Prompt injection and output attacks
Last updated:
Prompt injection is the insertion of instructions into an AI system’s input that override its intended behaviour, either directly by the user or indirectly through a web page, email or document the system reads. ISO/IEC 27090 recommends treating all external content as untrusted data, separating instructions from data, giving agents least-privilege tool permissions and requiring human approval for consequential actions. Output containing injection attacks is the reverse: model output carries a payload that a downstream system executes.
In this lesson you will learn to
- 01
Distinguish direct from indirect prompt injection
- 02
Explain why agents and tools raise the consequences of injection
- 03
Describe output containing injection attacks and the defence against them
- 04
Place denial of service and supply-chain compromise within the standard
Threat 8: prompt injection
Instructions hidden in input override the behaviour the system was designed to have. In direct injection the user types them. In indirect injection they arrive inside content the assistant reads: a web page, an email, a PDF, a calendar entry, a retrieved document. The asset hit is the service and its input; the objective is integrity; the threat concerns generative systems. The OWASP Top 10 for LLM applications ranks prompt injection first.
With agents and tools the consequences escalate. An assistant that can only answer questions is limited to saying the wrong thing. An agent that can send email, query a database or approve a request can be made to act. Policy bypass, data exfiltration through the assistant, unauthorised actions through connected tools and reputational harm from manipulated answers are the consequences the standard lists.
The standard’s message is that trusting external data sources is the risk. No filter reliably distinguishes data from directive, so the durable defence is architectural: assume injection succeeds and make sure what it reaches is worthless.
Detect: monitor inputs and outputs for instruction-like content
Detect: canary tokens in system prompts that reveal when a prompt has been exfiltrated
Detect: log prompt template versions with every request
Detect: red-team with indirect injection scenarios, not only typed attacks
Mitigate: treat all external content as untrusted data, never as instructions
Mitigate: separate the instruction context from the data context
Mitigate: least-privilege tool permissions; human approval for high-risk actions
Mitigate: output filtering and allow-lists on what the system may do
If the content a system reads cannot be trusted, its output cannot be trusted. Design the permissions around that assumption rather than around the hope that a filter catches every injection.
Threat 9: output containing injection attacks
This is the reverse direction. Model output carries a payload that a downstream system executes: script embedded in a web page, a database command, an operating system command. The model becomes a delivery channel into other applications, which may have nothing to do with AI. The asset hit is the output; the objective is the integrity of the consuming systems.
The consequence is compromise of applications that trusted the model’s output as if it were safe. Detection validates output against expected formats, security-tests every integration that consumes output, and monitors downstream systems for anomalous commands.
The fix is classic secure development: treat model output as untrusted input in every consuming system. Encode and sanitise output, use parameterised queries, sandbox any code execution, restrict what output can trigger, and apply the organization’s existing secure coding rules to AI integrations.
Denial of service and supply-chain compromise
Two further Annex B threats complete the picture of attacks on the service. Denial of service on inference uses flooding or resource-heavy inputs to make the model unavailable or expensive to run; rate limits, quotas, input size limits and capacity planning answer it. Supply-chain compromise introduces malicious or vulnerable models, data sets, libraries, notebook platforms and MLOps tools; supplier assessment, an AI bill of materials, signed artefacts and patching answer it.
Both are conventional attacks with AI-specific targets, which is why they sit in the annex. Their controls exist in ISO/IEC 27002 already; the work is extending supplier management and capacity management to cover the AI tool chain.
Controls for agents that act
Because injection reaches furthest when a system can act, the standard’s guidance converges with the practice of agentic AI governance: separate what an agent may propose from what it may do, scope tool authority narrowly, log the actions rather than only the outcomes, and place a human approval point before any action with financial, access or safety consequence.
| Control | Purpose | Example |
|---|---|---|
| Instruction and data separation | Retrieved content cannot rewrite the task | System prompt fixed; documents passed as quoted data |
| Least-privilege tools | Limits what a successful injection can reach | Read access to a case record, no write access |
| Human approval for consequential actions | A person decides before anything irreversible happens | Refund drafted by the agent, issued by a person |
| Action logging | Reconstructs what the agent did and why | Every tool call logged with the prompt template version |
| Output allow-lists | Only expected output shapes reach downstream systems | Structured fields, no free-form commands |
Key terms
- Direct prompt injection
- Instructions typed by a user that override the system’s intended behaviour.
- Indirect prompt injection
- Instructions hidden in content the system reads, such as a web page or document, that override its behaviour.
- Canary token
- A unique marker placed in a system prompt so that its appearance elsewhere reveals the prompt was leaked.
- Least privilege
- Giving a system or agent only the permissions needed for its task, so a compromise reaches as little as possible.
- Output encoding
- Transforming output so a consuming system treats it as data rather than executable instructions.
In one paragraph
Prompt injection overrides an AI system’s behaviour through its input, directly or through content it reads, and with agents it can trigger real actions. ISO/IEC 27090 treats all external content as untrusted data, separates instructions from data, scopes tool permissions, requires human approval for consequential actions and filters outputs. Output containing injection attacks sends payloads into downstream systems, so model output must be treated as untrusted input everywhere it is consumed. Denial of service and supply-chain compromise are handled with existing controls.
Lesson 8 quiz
Five questions. Score 4 or more to mark the lesson complete. Each answer shows an explanation, so a wrong answer teaches as much as a right one.
Questions people ask
- What is indirect prompt injection?
- Injection through content the AI system reads rather than through what the user types: a web page, an email, a document or a retrieved record carrying instructions that the model follows.
- Can prompt injection be filtered out?
- Not reliably. No filter distinguishes data from directive in every case. The standard’s approach is architectural: assume injection succeeds, limit what the system can do, and require human approval for consequential actions.
- What is an output injection attack?
- Model output that carries a payload, such as script or a database command, which a downstream system executes. The defence is to treat model output as untrusted input and sanitise it like any external data.
Shahzad Asghar
Senior IT Strategy and Portfolio Officer at UNRWA, with more than twenty years building and securing data and AI systems across UN agencies. He holds the CISM and CISSP security certifications and writes on AI governance, AI security and assurance, and digital transformation. Connect on LinkedIn.
This course is an independent educational resource by Shahzad Asghar. It is not affiliated with, endorsed by or published by ISO or IEC. ISO/IEC 27090:2026 is copyrighted and is sold through the ISO Store and national standards bodies; this course summarises it and does not reproduce its text. Last reviewed: .