Foundations · Intro · about 15 min
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
- System Prompt Extraction: Extract hidden system instructions through clever rewording.
- PII Leakage: Exploit over-privileged AI to leak employee salary data and PII.
- Insecure Plugin Design: Confused deputy attack on a smart home assistant with tool use.
- SQLi via LLM: UNION-based SQL injection through AI-generated text-to-SQL queries.
- Multi-Turn Jailbreak: Gradually erode safety guardrails across multiple conversation turns.
Catalog
Attack labs
20 hands-on scenarios across 4 tracks. Pick a target, launch a private sandbox, capture the flag.
Sessions
Active sessions
Resume a running lab or stop it before starting the next one.