---
title: "Treat model output as untrusted · Agent Wranglers"
url: https://agentwranglers.se/playbook/application-security/ai-features-and-agents/untrusted-model-output
id: APS-86
level: Recommended
applies: ai-features
updated: 2026-10-27
build: a2a6bdfed830
tokens: 627
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Treat model output as untrusted

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [AI features and agents](https://agentwranglers.se/playbook/application-security/ai-features-and-agents.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

- ID: APS-86
- Level: Recommended
- Chapter: [AI features and agents](https://agentwranglers.se/playbook/application-security/ai-features-and-agents.md)
- Rule: Handle every model answer like text from a stranger. Escape it before showing it, and never run it as code, SQL or a shell command.
- Check: Ask the model to repeat `<img src=x onerror=alert('PENTEST-5e6f')>` and a Markdown image pointing to test.example.org. The page shows plain text and loads nothing from outside.
- Applies when: The project uses AI models.
- How: Render answers as text or through a Markdown renderer that strips HTML and scripts. Block images and links to unknown sites, because they can carry data out in the address. If the model must build a query, give it a tool with fixed parameters instead.

## Sources

- [OWASP LLM10:2026 Improper Output Handling](https://github.com/GenAI-Security-Project/GenAI-LLM-Top10/blob/main/2026/final/LLM10_ImproperOutputHandling.md)

## Related rules

- AIF-34 [Check output before anyone sees it](https://agentwranglers.se/playbook/ai-features/guardrails-and-human-review/output-checks.md) in AI features
- APP-66 [Build generated screens only from your own components](https://agentwranglers.se/playbook/app-ui/generated-interfaces/generated-ui-components.md) in Web app interface

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/application-security/ai-features-and-agents/untrusted-model-output">Agent Wranglers application security playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Give agent tools the least power they need](https://agentwranglers.se/playbook/application-security/ai-features-and-agents/least-privilege-tools.md)
- Next: [Keep secrets out of the system prompt](https://agentwranglers.se/playbook/application-security/ai-features-and-agents/no-secrets-in-prompt.md)
- [AI features and agents](https://agentwranglers.se/playbook/application-security/ai-features-and-agents.md)
