DOM clobbering
Summary: DOM clobbering is a technique where injecting HTML into a page manipulates the DOM and changes how JavaScript behaves, and it is most useful when XSS is not possible but you control HTML where id or name attributes pass the filter. The most common form uses an anchor element to overwrite a global variable the application then uses unsafely, such as to generate a dynamic script URL, and a form with an input can clobber the attributes property so a client-side filter enumerates the input instead of the form and leaves injected attributes like onclick in place.
Why it matters: A client-side filter that loops over element.attributes.length can be defeated by a single injected input element, because the clobbered property has an undefined length and the loop never runs - so the filter passes the element and the onclick handler survives.
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