Tag and Attribute Variations
What you'll learn: How attackers exploit uncommon HTML tags and attributes to bypass filters that only block the most obvious XSS vectors.
The Core Idea
Most basic XSS filters focus on blocking dangerous tags like <script> and common event handlers like onclick. But HTML has hundreds of valid tags and attributes—many of which can execute JavaScript but rarely make it onto blocklists. By using obscure, valid HTML elements, attackers can slip past simple pattern-matching filters.
Think of it like a nightclub bouncer who only knows to reject people wearing leather jackets. If you show up in a tuxedo or a Hawaiian shirt, you might walk right in—even if you're just as much trouble.
Uncommon Tags That Execute JavaScript
Instead of <script>, attackers might try:
<svg onload=alert(1)><marquee onstart=alert(1)><details ontoggle=alert(1)><body onpageshow=alert(1)>
These tags are completely valid HTML but often overlooked by filters.
Custom and Data Attributes
Attackers also leverage lesser-known attributes:
<input onfocus=alert(1) autofocus>(auto-triggers focus event)<video><source onerror=alert(1)>(triggers on load failure)<form><button formaction=javascript:alert(1)>(alternative action attribute)
Even valid attributes like href, src, or data can be weaponized when combined with protocols like javascript: or data:text/html.
Why This Works
Security filters often use allowlists or denylists of known-bad patterns. By using valid but uncommon tags, attackers exploit gaps in these lists. The browser faithfully renders and executes the code because it's legitimate HTML—just not what defenders expected.
Key Takeaway: Effective XSS filters must account for the vast surface area of HTML, not just the obvious attack vectors—obscure tags and attributes are just as dangerous as <script>.