Overview
The challenge presents a ticketing application where tickets can be created through POST /api/tickets. The application explicitly supports HTML in ticket messages — the regular customer view displays messages as text, but agents review tickets in a real browser using the agent ticket page. This makes the ticket body a stored-XSS target.
The agent page also exposes useful internal functionality: GET /api/flag and POST /api/tickets/<id>/note. The normal user account receives a decoy response from /api/flag, while the agent browser has the privileged session needed to retrieve the real flag.
Prerequisites / Setup
export TARGET="<challenge URL or IP>"
curl is sufficient; no wordlist or credentials are required beyond registering a normal account.
Recon
Step 1 — Register an account and create a ticket
Goal: Confirm the ticket creation endpoint and that HTML in the ticket body is stored.
The regular customer view displays messages as text, but agents review tickets in a real browser.
Vulnerability Analysis
The flaw class is Stored XSS (cross-site scripting), where attacker-supplied HTML is stored server-side and rendered in a privileged context.
Exploitation
Step 2 — Submit a ticket with an iframe XSS payload
Goal: Have the agent’s browser load /api/flag in an iframe, read the response, and POST it as an internal note on the same ticket.
Basic <script> and event-handler markup is sanitized. However, malformed slash syntax bypasses the sanitizer — an SVG element using <svg/onload=...> is retained and executed by the browser. An iframe is useful because it loads /api/flag in the same origin; its load handler can read the response body from contentDocument, then use the agent’s session to add that value as an internal note on the same ticket.
The submitted ticket body was:
<iframe/src='/api/flag'/onload=fetch('/api/tickets/1000/note',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(this.contentDocument.body.innerText)}>
The ticket ID was adjusted to match the newly created ticket. When the agent opened the ticket:
- The iframe requested
/api/flagusing the agent’s privileged session. - The iframe load handler read the response text.
- A same-origin
POSTadded the response as an internal note.
The ticket API then returned:
{
"notes": [{ "author": "admin", "text": "FLAG{REDACTED}" }]
}
Flag
FLAG{REDACTED}
Retrieved from the internal note created by the agent’s browser after the stored-XSS payload loaded /api/flag in an iframe.
Lessons / Takeaways
- Never render customer-controlled HTML in an agent’s authenticated browser.
- Prefer plain text, or apply a well-tested allowlist sanitizer that removes event handlers, SVG, iframe, dangerous URL schemes, and other active content.
- Sensitive endpoints such as
/api/flagshould also require explicit authorization and should not be exposed in agent-facing pages unnecessarily.
Mitigations
- Do not render user-controlled HTML in privileged contexts.
- Apply a well-tested allowlist sanitizer that removes event handlers, SVG,
<iframe>, dangerous URL schemes, and other active content. - Require explicit authorization on sensitive endpoints and limit their exposure in agent-facing pages.
Techniques
- Stored XSS
- Cross-Site Scripting
References
- OWASP, “Cross-Site Scripting (XSS)”: https://owasp.org/www-community/attacks/xss/
- PortSwigger, “Stored XSS”: https://portswigger.net/web-security/cross-site-scripting/stored-xss

