Lab: Clobbering DOM attributes to bypass HTML filters
Summary: PortSwigger's lab uses the HTMLJanitor library, which filters HTML attributes through its attributes property, but that property can itself be clobbered so its length becomes undefined, letting an attacker inject arbitrary attributes into a form element. The solution smuggles the print() function into an onfocus attribute, then loads an iframe from the exploit server that appends the #x fragment to the page URL after a 500ms delay, focusing the injected form and firing the handler; the intended solution does not work in Firefox.
What you should know: The bypass hinges on a filter trusting a DOM property an attacker can overwrite, so any sanitizer that reads its configuration from the page it is sanitizing may be one clobbered property away from passing through attributes it was meant to strip.
Read the original at PortSwigger Research ↗
- Topics
- Vulnerabilities & Patching
- Related
- Attackers Exploit UnrealIRCd Flaw That Enables Server-Level Command Injection Cyber Risks · Nov 14, 2026U.S. CISA adds Check Point and UnrealIRCd flaws to its Known Exploited Vulnerabilities catalog Cyber Risks · Nov 14, 2026PostgreSQL Patches 52 Flaws, Including 22-Year-Old Bug Enabling Authenticated RCE Cyber Risks · Nov 13, 2026