Packages / dompurify / Security

ModerateVulnerabilityGHSA-cjmm-f4jc-qw8rCVE-2026-65912Published 3 Apr 2026

DOMPurify ADD_ATTR predicate skips URI validation

Affected releases · dompurify

  • 3.x3.0.0 – 3.3.1Fixed in 3.3.2
  • 2.x2.0.0 – 2.5.9No fix on this line yet
  • 1.x and older0.4.0 – 1.1.1No fix, no longer updated

On 3.x, the newest line:

npm install dompurify@3.3.2
3.x
  1. Affected

    3.0.0 – 3.3.1

    30 releases

  2. Fixed

    3.3.2 – 3.4.17

    20 releases, latest

2.x
  1. Affected

    2.0.0 – 2.5.9

    63 releases

1.x
  1. Affected

    1.0.0 – 1.1.1

    14 releases

0.x
  1. Affected

    0.4.0 – 0.9.0

    29 releases

156 stable releases of dompurify, oldest to newest, one row per major.

Is your project affected?

Paste your package.json, or type the range you declare for dompurify. It is read in your browser and sent nowhere.

What happens

Summary

DOMPurify allows ADD_ATTR to be provided as a predicate function via EXTRA_ELEMENT_HANDLING.attributeCheck. When the predicate returns true, _isValidAttribute short-circuits the attribute check before URI-safe validation runs. An attacker who supplies a predicate that accepts specific attribute/tag combinations can then sanitize input such as <a href="javascript:alert(document.domain)"> and have the javascript: URL survive, because URI validation is skipped for that attribute while other checks still pass. The provided PoC accepts href for anchors and then triggers a click inside an iframe, showing that the sanitized payload executes despite the protocol bypass.

Impact

Predicate-based allowlisting bypasses DOMPurify's URI validation, allowing unsafe protocols such as javascript: to reach the DOM and execute whenever the link is activated, resulting in DOM-based XSS.

Credits

Identified by Cantina’s Apex (cantina.security).