Skip to content
XSS Write-up Advanced

DOM Purify - dirty namespace bypass

A bypass was found in DOMPurify when it sanitises SVG content, allowing malicious markup to survive sanitisation. An attacker could use this to inject active content into pages that rely on DOMPurify for SVG sanitisation.

blog.slonser.info

Published on blog.slonser.info

In this article, I want to talk about a method for bypassing DOMPurify when it is used for sanitizing SVG files, which I recently discovered.

The author, on blog.slonser.info

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Impact

An attacker could bypass DOMPurify's SVG sanitisation and inject active content, potentially leading to script execution in the context of a site that relies on it.

What the attacker needed

DOMPurify used to sanitise SVG; attacker can supply SVG content

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

DOMPurify is a library that cleans HTML and SVG so dangerous parts are removed before a page displays them. This report says that when it cleans SVG files, some dangerous content can slip through. That means a page trusting DOMPurify to make SVG safe might still run attacker-controlled code.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.