*Reflected XSS in HTML Context with All Standard Tags Blocked Except Custom Ones*
The application reflected unsanitised user input into an HTML context but blocked all standard HTML tags, allowing only custom tags. An attacker could inject a custom tag with an event handler to execute arbitrary JavaScript in a victim's browser.
Published on osintteam.blog
Cross-site scripting (XSS) vulnerabilities can surface in unexpected places — even when a web application blocks all standard HTML tags. In this lab challenge provided by PortSwigger, the page reflects unsanitized input back into an HTML context, but with a twist: it filters out all standard tags (<script>, <img>…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The input filter used a blacklist of standard HTML tags but did not sanitise event handler attributes, and allowed custom tags.
Impact
An attacker could execute arbitrary JavaScript in a victim's browser, potentially accessing cookies, session tokens, or local storage, especially if HttpOnly flags are misconfigured.
What the attacker needed
Victim clicks a link; attacker uses PortSwigger lab environment
How it was found
- Open the lab.
- Test with a basic HTML tag like <body> and observe it is blocked.
- Use Burp Intruder to test a list of event handler tags from the PortSwigger XSS cheat sheet, setting the tag part as the attack position and limiting concurrent requests to 1.
- Analyse results to find that custom tags like <audio2> are accepted.
- Build a working payload using <audio2> with autofocus, tabindex, and onfocus=alert(1), and test it in the search input.
- Prepare an exploit on the Exploit Server: first try an iframe (blocked by X-Frame-Options), then use a JavaScript redirect to the vulnerable URL with the payload, store and deliver to the victim.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A website took what you typed and put it directly into the page without cleaning it. It tried to block common dangerous tags like script, but forgot that you can make up your own tag names. By using a made-up tag with an event handler, an attacker can still run code in your browser.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.