REDHAT-BUG-2506428: Medium severity npm/dompurify vulnerability
DOMPurify 3.0.0 before 3.4.9 does not reset the retained Trusted Types policy when clearConfig() is called, so a DOMPurify instance reused across trust boundaries stays bound to a previously supplied TRUSTEDTYPESPOLICY. A later caller that requests RETURNTRUSTEDTYPE output receives a TrustedHTML object created by the old (potentially unsafe) policy rather than a clean default, which can lead to script execution at a Trusted Types sink. Passing TRUSTEDTYPESPOLICY: null on the later call also does not clear the retained policy.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
DOMPurifyto a version that resolves this vulnerability.Fixed in 3.4.9
Event History
Frequently Asked Questions
Which deployments are realistically exposed?
Deployments using DOMPurify versions 3.0.0 through before 3.4.9 are exposed when the same DOMPurify instance is reused across trust boundaries and a prior caller has supplied a TRUSTED_TYPES_POLICY.
What conditions are required for exploitation?
A later caller must request RETURN_TRUSTED_TYPE output from the reused instance. The retained earlier policy must be potentially unsafe, allowing the later caller to receive TrustedHTML created under that policy for use at a Trusted Types sink.
Does calling clearConfig() or setting TRUSTED_TYPES_POLICY to null remove the risk?
No. In affected versions, clearConfig() does not reset the retained Trusted Types policy, and passing TRUSTED_TYPES_POLICY: null on a later call also does not clear it.