labs / xss
XSS Playground
Post a payload into a sandboxed guestbook and steal the victim's secret.
The guestbook below shows every message without escaping it — and
renders inside a victim's browser. Your message becomes part of their page. A classic starter:
<img src=x onerror="...">. Read window.LOOT and send it to the
steal endpoint (e.g. new Image().src='/api/labs/xss/steal?t='+window.LOOT).
Victim's browser (sandboxed)
How the fix works & why this is safe
The fix is output encoding: render user text as text, so < becomes
< and never starts a tag. A Content-Security-Policy without
'unsafe-inline' is strong defense-in-depth. This lab is safe because the payload runs
in a sandbox="allow-scripts" iframe with no same-origin access — it can't touch the
real page, your cookies, or other users.