Cyber Risks · PortSwigger Research

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