Cyber Risks · PortSwigger Research

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