What is insecure AI output handling?
Insecure AI output handling is the vulnerability arising when a language model's text, code or commands reach a browser, database, shell or other system without adequate validation, sanitisation and encoding, risking cross-site scripting, SQL injection or remote code execution.
Unlike an output guardrail, which catches harmful or out-of-policy content, it is the risk that even harmless-looking output is interpreted downstream as code or commands. Since prompts steer output, this resembles giving users indirect extra functionality.
- Topic
- AI security
- Also known as
- Improper output handling
How insecure AI output handling works
- An attacker uses direct or indirect prompt injection to make the model produce specific output.
- The application passes it unvalidated to a web page, SQL query, shell command or other tool.
- The script, query or command in the output runs in the target system.
- Mitigation: treat the model as an untrusted user, encode output for its context and use parameterised queries and allowlists.
In more detail
Markdown and rich-text leakage, SSRF and CSV formula injection
Insecure output handling extends beyond `