Skip to main content
VulnerabilityPublished Updated

DOMPurify SAFE_FOR_TEMPLATES bypass: split template expressions survive in attached shadow root content on DOM output

Affects dompurifySource GCVE Database

0

CVSS 2.3 Low : upgrade to 3.4.17 when convenient.

Data as of 19 Nov 2026, 00:51 UTC

CVSS 4.0 base score
2.3Low
How severe the flaw is on the 0–10 CVSS scale.
Patch
Available – fixed in 3.4.17
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N

What to do

Upgrade dompurify to 3.4.17.

Affected software

ProductAffectedFixed in
npmdompurifyAffected
  • >=3.4.4 <3.4.17
Fixed in
  • 3.4.17

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

A fix for this vulnerability is available in DOMPurify version 3.4.17. Users should upgrade to this version or later to ensure the post-walk safety net properly handles attached shadow roots. Until upgraded, applications should avoid enabling SAFE_FOR_TEMPLATES with DOM-returning modes on DOM nodes containing attached shadow roots that are later evaluated as templates.

Description

A vulnerability in DOMPurify when configured with SAFE_FOR_TEMPLATES and a DOM-returning mode allows template expressions split across text nodes in attached shadow roots to survive sanitization. This occurs because the post-walk safety net does not recurse into shadow roots, enabling attackers who supply DOM nodes with shadow roots to inject expressions that are later evaluated by template engines. Exploitation requires specific non-default configurations and attacker control over DOM nodes with attached shadow roots. The vulnerability is fixed in version 3.4.17.

References

Community reviews

Loading reviews…