Where Does the Answer Go? — Spot the Unsafe Sinks
A support app takes the reply from its language model and uses it in six places. Some treat it as plain text. Others hand it to a browser, a database or a shell that trusts whatever it is given. Find the unsafe ones before an attacker steers the model into writing something hostile.
What is improper output handling?
Improper output handling means an application trusts what its language model wrote. The reply is passed to a browser, a database, a shell or another system as if a developer had written it.
The model does not decide what it writes on its own. A user prompt, a web page it summarised or a document it retrieved can all shape the reply, so an attacker who controls any of those can aim the reply at whatever consumes it.
A real case
We have not found a public incident from 2025 or 2026 that matches this technique closely enough to cite, so we are not listing one here.
How to fix it
- Treat every model reply as untrusted input, the same as a form field.
- Render replies as text. If you must render HTML or markdown, sanitise it with a maintained library first.
- Use parameterised queries for anything that reaches a database.
- Never build shell commands from a reply. Call programs with an argument list and validate each value against an allow-list.
Questions people ask
Is this the same as prompt injection?
No. Prompt injection is how the attacker steers the model. Improper output handling is the application flaw that turns the steered reply into XSS, SQL injection or command execution.
Can a system prompt stop this?
Not reliably. An instruction asking the model not to write HTML or SQL is a request, not a control. The fix belongs in the code that consumes the reply.
Read the full OWASP LLM Top 10 guide · All free labs · AI red team certification