NEW350+ rooms now have a live terminal, so you can learn by typing the commands, right in your browser.Learn in a live terminal. 350+ rooms.Try a lab♥ Codelivly is 100% free, no paywall. If it helped you, chip in to keep it running.100% free. Help keep it so.Support us
[>_] ROOM · Cybersecurity
Cross-Site Scripting via LLM Output
Master the mechanics of Cross-Site Scripting (XSS) via LLM output. Learn how attackers weaponize AI-generated HTML/JS and defend with strict sanitization and CSP.
Room tasks
1What is XSS via LLM Output and Why It Happens
2Crafting Prompts That Produce Malicious HTML/JS
3Guided Lab: Triggering Stored XSS via a Chatbot Response
Frequently Asked Questions
How can an LLM cause cross-site scripting?
If an app renders model output as HTML without sanitizing it, an attacker can prompt the model to emit script tags or event handlers. The browser runs them in the victim's session.
How do you prevent XSS from LLM output?
Treat model output as untrusted: encode it, sanitize with a library like DOMPurify, render as plain text or safe markdown and apply a strict Content Security Policy.
Why is this considered insecure output handling?
The model itself is not the flaw. The vulnerability is the application trusting its output downstream. This free room explains the pattern and how to test for it.