Skip to content
XSS Write-up Advanced

Intigriti XSS Challenge July 2024 — Finding a new DOMPurify bug

The challenge page had a DOM-based XSS vulnerability protected by CSP, and the author found a way to bypass it by using DOM clobbering to trigger a development code path and a new DOMPurify bug that caused an uncaught error, leading to script execution. An attacker could execute arbitrary JavaScript in the context of the challenge page.

realansgar Follow

Published on realansgar.dev

Another monthly XSS challenge from Intigriti’s Twitter , by al and wubz hosted at https://challenge-0724.intigriti.io/ . I had a lot of fun banging my head against this one and solving it with a fresh bug in DOMPurify (no, it’s not a bypass!).

realansgar (@realansgar), on realansgar.dev

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

Root cause

Likely the root cause is that the page used an undeclared global variable (isDevelopment) that could be clobbered via DOM, and DOMPurify's error handling could be triggered by clobbering form properties, leading to an uncaught error that activated a script-loading gadget.

Impact

An attacker could execute arbitrary JavaScript in the context of the challenge page, but the exploit required specific conditions and was limited to the challenge environment.

What the attacker needed

Victim visits a crafted URL; attacker hosts a script; CSP with strict-dynamic

The fix

DOMPurify was patched to avoid property accesses on potentially clobbered nodes by using saved references from the Element prototype.

How it was found

  1. Inject a div with id isDevelopment to make the isDevelopment variable truthy.
  2. Inject a base tag to change the base URL for relative scripts.
  3. Inject a form with inputs named nodeName, parentNode, and remove to trigger a DOMPurify error.
  4. The error causes the catch block to add a script tag loading logger.js from the attacker's server.

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.

This is a write-up of a security challenge where the goal was to execute JavaScript on a web page despite protections. The author found a clever way to make the page's own code load a malicious script by exploiting how browsers handle element IDs and a bug in a sanitisation library.

What is XSS?

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

More from DOMPurify

View all

The newest disclosed reports for this program.

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.