Unsafe LLM Output Handling
Testing what happens when an LLM's output is passed downstream — rendered as HTML, executed as code, or used to build a database query — without treating it as untrusted.
- Category
- LLM Security
- Difficulty
- Foundational
- Last Updated
- 20 September 2026
Lab detail
Objective
Model output is often trusted implicitly by the application that generated it, even though it is influenced by untrusted input (the user’s prompt, or retrieved/ingested content). This lab will test reference applications that render, execute or forward LLM output into common downstream sinks (HTML rendering, a code-execution sandbox, a database query) for classic injection consequences.
Planned Scope
- Build small reference sinks: an HTML-rendering chat UI, a “generate and run a query” tool, a code-execution sandbox.
- Test whether adversarial prompts can produce output that exploits each sink (XSS, injection, unsafe execution).
- Measure the effect of output encoding, sandboxing and schema validation as mitigations.
- Document safe-by-default patterns for each sink type.
Framework Mapping
Referenced frameworks
Exact control-ID mappings are to be validated as this lab progresses — see the full Frameworks reference.
Responsible Use / Safety Notes
How this lab is run
This lab uses synthetic data and controlled environments. It is intended to demonstrate defensive AI-security principles and does not contain customer data, production credentials or intentionally weaponized exploit infrastructure.
A decision is waiting for sign-off. Get an independent view first.
Tell me what is being decided and what is at stake. I will first say honestly whether my experience fits — then we talk about scope, not before.
Or connect on LinkedIn first.