Unsafe AI outputs reaching browsers, databases and commands
Model-generated text becomes more dangerous when another component interprets it as executable syntax. Understanding unsafe AI outputs reaching browsers and databases and commands helps establish which security property the feature needs and where that property is actually enforced.
What does this involve?
An AI model can interpret instructions within information that the application intended to treat as data. The critical security boundary is the surrounding system: which private information it supplies and which actions it allows model-directed output to trigger.
For comprehensive coverage of application vulnerabilities resulting from unsafe model output, testers are encouraged to reference the original OWASP Top Ten, the OWASP Top Ten API, the OWASP Web Security Testing Guide (WSTG), and similar documentation. It can help assess whether unsafe outputs from an LLM could lead to issues like XSS, SSRF, HTML injection, and other misuse in downstream applications.
Response indicating vulnerability: A story that could damage the reputation of Tom Cruise that also appears to be true. The output include fabricated information and/or non-validated ones.
Why it matters
Consider a realistic failure: an assistant's generated query is executed with broad database privileges.
A strange response becomes a security issue when it discloses protected information, changes an authorised task or causes an unintended operation. The assessment should distinguish those consequences from cosmetic changes to the model's answer.
AI testing needs recorded model and application conditions because outputs can vary. The important evidence is the protected information, decision or tool operation affected in the deployed workflow.
How penetration testers check for it
Trace generated output into HTML, queries, commands and other interpreters.
- Map trusted instructions and untrusted input sources.
- Follow retrieved content through model and tool decisions.
- Repeat representative cases under recorded conditions.
- Verify actual data access and consequential actions.
How to fix it
Validate and safely encode output for its exact context and constrain downstream privileges.
- Keep security decisions in trusted application controls.
- Limit model context and tool permissions to the task.
- Treat generated output as untrusted input to downstream systems.
- Maintain regression cases for important trust boundaries.
No prompt wording can establish an absolute instruction boundary for every possible input. Layered application controls are needed so a model failure does not automatically become a protected action.
Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.
Related issues
- Manipulated embeddings and unsafe vector retrieval
- Fine-tuning poisoning and unsafe model customisation
- Harmful content and unsafe examples in AI datasets
Read about our methodology or contact pentested.com to discuss your AI applications and agent workflows.