ASD ISM 2158 Treat agentic AI retrieved external content as untrusted data
What it says
External content retrieved by agentic AI applications is treated as untrusted data throughout processing, is clearly delimited from system instructions, is subject to validation and sanitisation measures applied to other untrusted input, remains untrusted following such processing, and is prevented from modifying or overriding system instructions, security policies, access controls, tool permissions or human approval requirements.
Quoted as published. Everything else on this page is written by Control Stack.
In plain English
Agentic AI applications must handle retrieved external content as untrusted data that is delimited, validated and sanitised, and can never change their instructions, permissions or approvals.
Agentic AI applications, meaning AI applications that act by themselves, must handle external content they retrieve, such as web pages, emails and documents, in four ways:
- Untrusted throughout: treated as untrusted data at every step, and still untrusted after validation and sanitisation.
- Delimited: clearly marked off from system instructions.
- Validated and sanitised: checked and cleaned by the same measures as other untrusted input.
- Unable to override: prevented from changing or overriding system instructions, security policies, access controls, tool permissions or human approval requirements.
Free. Save your status, tasks and notes.
Why it matters
Retrieved content can carry hidden instructions that the model follows as if they came from its operator, letting an outsider steer the agent. Cleaning reduces this but cannot make content trustworthy, so the agent's rules and limits must sit beyond the content's reach.
How to implement
List every route that brings external content to the agent.
Include web browsing, email, file and document reading, searches of knowledge stores, and results returned by tools or other systems. For agents that process classified data, ISM-2112 requires direct access to external public data sources to be disabled.
Pass retrieved content separately from instructions.
Put it in its own message role or field, labelled as untrusted data between clear start and end markers, never in the system prompt, and escape any text imitating a marker. On a vendor's agent platform, confirm it keeps retrieved content apart from instructions, and switch on any indirect prompt injection filtering it offers.
Validate and sanitise it as you would other untrusted input.
Apply the same measures that ISM-1240 and ISM-2016 require for input arriving over the internet or a local network, such as checking type, size and encoding, converting to plain text and stripping scripts, hidden text and invisible characters. Keep the untrusted label on the result and anything derived from it.
Hold instructions, permissions and approvals outside the model.
Load system instructions and security policies from configuration the agent cannot write, enforce access controls and tool permissions at the tool or a gateway, and require human approval in orchestration code for sensitive or high-impact actions (ISM-2113), so no retrieved text can change them.
Test with planted instructions on every route.
Use test web pages, emails and documents that tell the agent to change its instructions, call a tool it should not, widen its access or skip approval. Each attempt must fail because of a control outside the model, not because the model declined.
Keep it running
Re-run the planted-instruction tests after any change to the model, system instructions, tools or retrieval sources, and add new injection techniques as they are published. Give any new retrieval route, such as a new connector, the same handling before it goes live.
Evidence and audit
- Check 1 of 3What an auditor asks for
Ask for
The design or code for each route by which a sampled agent retrieves content, compared with the tools and connectors in its live configuration.
Look at
Whether every live route delimits retrieved content, applies the validation and sanitisation used for other untrusted input, and keeps it marked untrusted.
Good evidence
Every route in the live configuration delimits retrieved content from system instructions, applies the same validation and sanitisation as other untrusted input, and never marks the result as trusted.
- Check 2 of 3What an auditor asks for
Ask for
A test using planted instructions on each route by which the agent retrieves content, such as web pages, emails, documents and tool results.
Look at
Whether any planted instruction changes the agent's system instructions, security policies, access controls, tool permissions or human approval requirements.
Good evidence
No planted instruction changes or overrides any of them, and each attempt is stopped by a mechanism outside the model rather than by the model declining.
- Check 3 of 3What an auditor asks for
Ask for
The storage of the agent's system instructions, security policies, access controls, tool permissions and approval settings, with who and what can write to them.
Look at
Whether the agent's runtime identity, or any tool it can call, can modify them.
Good evidence
Neither the agent's runtime identity nor any tool it can call can modify its system instructions, security policies, access controls, tool permissions or approval settings.
Mappings
Closest match in ISO/IEC 27001: A.8.27, Secure system architecture and engineering principles, which this control partially meets.
ISO/IEC 27001: 2 mappings
This control partially meets A.8.27.
ISM-2158 requires architectural and runtime controls so that untrusted retrieved content cannot override system instructions, security policies, access controls, tool permissions, or human approvals. Annex A 8.27 requires establishing and applying secure system architecture and engineering principles, which is the broader mechanism that would drive design patterns like instruction/data separation, policy enforcement points, and least-privilege tool interfaces for agentic AI. ISM-2158 is a concrete architectural requirement within the wider secure engineering principles mandated by Annex A 8.27.
This control partially meets A.8.28.
ISM-2158 focuses on secure handling of externally retrieved content in agentic AI, including input delimitation, validation/sanitisation, and preventing untrusted data from changing governing instructions or controls. Annex A 8.28 requires secure coding practices, which directly supports implementing robust parsing, input validation, content sanitisation, and safe tool-calling boundaries needed to meet ISM-2158. Annex A 8.28 is broader because it applies to all software development, while ISM-2158 targets a specific agentic AI threat pattern (retrieved-content/prompt injection).
Mappings show how controls relate across frameworks. They do not imply full equivalence or certification.




