Prompt Injection to XSS

Unsanitized LLM output rendering enables cross-site scripting.

What you practise

Cross-site scripting via the AI's response. You run the attack yourself on a live model in a private sandbox set up for you, then capture the flag. Nothing to install and no API key.

Why <img>, not <script>?

Modern browsers refuse to execute <script> tags inserted via innerHTML, a defense added long ago. But they still fire onerror, onload, and onmouseover handlers on other tags like <img>, <svg>, or <iframe>. That asymmetry is most of practical LLM-XSS in 2026, and the same rule keeps tripping up developers shipping LLM-driven chat UIs.

Where this has happened

  • Bing Chat “Sydney” (Feb 2023): Injected content on summarized webpages steered the bot into emitting XSS payloads in its replies. Microsoft's response was to disable rich rendering for untrusted content.
  • ChatGPT plugin exfiltration (mid 2023): Markdown image rendering leaked chat history via crafted alt-text URLs. Same idea, different surface: the model emits a tag, the browser auto-fetches the URL.
  • Slack AI summary (2024): Channel content told the summarizer to include attacker-controlled links in its output, indirect prompt injection ending in a malicious link.

Sign in to launch this lab Learn the theory in the Academy

More Foundations labs

Attack labs

20 hands-on scenarios across 4 tracks. Pick a target, launch a private sandbox, capture the flag.

Active sessions

Resume a running lab or stop it before starting the next one.