GitHub Advisoryadvisory · npm

GHSA-cjmm-f4jc-qw8r DOMPurify ADD_ATTR predicate skips URI validation

MEDIUM Published 2026-04-03 Modified 2026-07-23 Official page ↗
Aliases
CVE-2026-65912
Ecosystem
npm
Packages
dompurify
Severity
Moderate
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
Weaknesses
CWE-183
Reviewed
2026-04-03

Affected packages

• npm dompurify: < 3.3.2 → fixed in 3.3.2

Description

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 `` 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 (https://www.cantina.security).

Related

Alias · CVE (1)

  • CVE-2026-65912 DOMPurify before 3.3.2 contains a URI validation bypass vulnerability when ADD_ATTR is provided as a predicate function via… vulnerability

Weakness · CWE (1)

  • CWE-183 Permissive List of Allowed Inputs weakness

References