CVE-2025-26791
Medium · 4.5DOMPurify allows Cross-site Scripting (XSS)
CVSS
4.5
EPSS
0.6%
Published
Feb 14, 2025
CISA due date
—
Cloudanix analysis
A flaw in a popular tool that cleans up web content can let attackers slip in hidden scripts that run when users view the page, risking stolen information or unwanted actions.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Moderate
- Impact
- Data Exposure
- Component
- Library
- Class
- XSS
- Remediation
- Upgrade
- Effort
- Low
- Patch risk
- Low
What it actually does
Incorrect regular expression handling of template literals in DOMPurify allows crafted input to bypass sanitization and trigger mutation XSS by altering the DOM structure after initial parsing.
Why it matters to the business
Applications relying on this library for content sanitization may allow malicious scripts to execute in users' browsers, leading to potential data theft, session hijacking, or unauthorized actions on behalf of users.
How an attack unfolds
An attacker supplies specially crafted HTML containing template literal syntax that evades the flawed regex check; after DOMPurify sanitizes and the browser mutates the content, the payload executes as JavaScript in the victim's context.
How to fix it
Upgrade cure53/dompurify to the commit d18ffcb554e0001748865da03ac75dd7829f0f02 or later release containing the corrected template literal regular expression; re-test all sanitization paths with known mXSS test vectors.
How to confirm the fix worked
Confirm the installed version is at or beyond the fixed commit, run the library's test suite including mXSS cases, and perform manual verification by feeding the original bypass payloads through the updated sanitizer.
Typical attack path
- Identify a web application using a vulnerable DOMPurify version for sanitizing user-controlled or third-party content.
- Craft malicious input using template literal syntax designed to survive the regex filter.
- Submit the payload through an input field, API endpoint, or imported data source.
- Trigger client-side rendering that invokes DOMPurify followed by DOM insertion.
- Observe mutation that activates the embedded script and performs actions such as cookie exfiltration or form submission.
How to detect it
Review web application logs and browser telemetry for unexpected script execution or DOM changes following content sanitization; inspect network requests or storage access that originate from sanitized user content areas.
What your security team should do
- Immediately update all instances of DOMPurify to the fixed commit in development, staging, and production environments.
- Audit codebases for direct or transitive dependencies on older DOMPurify versions and enforce version pinning in package manifests.
- Add automated dependency scanning and alerts for future library updates.
- Review and expand input sanitization test coverage to include template literal and mutation scenarios.
The record
DOMPurify before 3.2.4 has an incorrect template literal regular expression, sometimes leading to mutation cross-site scripting (mXSS).
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| npm | dompurify | 0 | 3.2.4 |
| Chainguard | grafana-image-renderer | 0 | 3.12.1-r1 |
| Chainguard | opensearch-dashboards-2 | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-alerting-dashboards-plugin | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-anomaly-detection-dashboards-plugin | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-compat | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-config | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-dashboards-maps | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-dashboards-notifications | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-dashboards-observability | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-dashboards-query-workbench | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-dashboards-reporting | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-dashboards-search-relevance | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-dashboards-visualizations | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-fips | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-fips-alerting-dashboards-plugin | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-fips-anomaly-detection-dashboards-plugin | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-fips-config | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-fips-dashboards-maps | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-fips-dashboards-notifications | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-fips-dashboards-observability | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-fips-dashboards-query-workbench | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-fips-dashboards-reporting | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-fips-dashboards-search-relevance | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-fips-dashboards-visualizations | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-fips-index-management-dashboards-plugin | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-fips-ml-commons-dashboards | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-fips-security-analytics-dashboards-plugin | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-fips-security-dashboards-plugin | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-index-management-dashboards-plugin | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-ml-commons-dashboards | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-security-analytics-dashboards-plugin | 0 | 2.19.0-r1 |
| Chainguard | opensearch-dashboards-2-security-dashboards-plugin | 0 | 2.19.0-r1 |
| Debian:12 | node-dompurify | 0 | No fix |
| Debian:13 | node-dompurify | 0 | No fix |
| Wolfi | grafana-image-renderer | 0 | 3.12.1-r1 |
| Wolfi | opensearch-dashboards-2 | 0 | 2.19.0-r1 |
| Wolfi | opensearch-dashboards-2-alerting-dashboards-plugin | 0 | 2.19.0-r1 |
| Wolfi | opensearch-dashboards-2-anomaly-detection-dashboards-plugin | 0 | 2.19.0-r1 |
| Wolfi | opensearch-dashboards-2-compat | 0 | 2.19.0-r1 |
| Wolfi | opensearch-dashboards-2-config | 0 | 2.19.0-r1 |
| Wolfi | opensearch-dashboards-2-dashboards-maps | 0 | 2.19.0-r1 |
| Wolfi | opensearch-dashboards-2-dashboards-notifications | 0 | 2.19.0-r1 |
| Wolfi | opensearch-dashboards-2-dashboards-observability | 0 | 2.19.0-r1 |
| Wolfi | opensearch-dashboards-2-dashboards-query-workbench | 0 | 2.19.0-r1 |
| Wolfi | opensearch-dashboards-2-dashboards-reporting | 0 | 2.19.0-r1 |
| Wolfi | opensearch-dashboards-2-dashboards-search-relevance | 0 | 2.19.0-r1 |
| Wolfi | opensearch-dashboards-2-dashboards-visualizations | 0 | 2.19.0-r1 |
| Wolfi | opensearch-dashboards-2-index-management-dashboards-plugin | 0 | 2.19.0-r1 |
| Wolfi | opensearch-dashboards-2-ml-commons-dashboards | 0 | 2.19.0-r1 |
| Wolfi | opensearch-dashboards-2-security-analytics-dashboards-plugin | 0 | 2.19.0-r1 |
| Wolfi | opensearch-dashboards-2-security-dashboards-plugin | 0 | 2.19.0-r1 |
| openSUSE:Tumbleweed | argocd-cli | 0 | 2.14.8-1.1 |
Related vulnerabilities
- CVE-2026-49978 DOMPurify is a DOM-only cross-site scripting sanitizer for HTML, MathML, and SVG. Also affects dompurify
- CVE-2026-49459 DOMPurify is a DOM-only cross-site scripting sanitizer for HTML, MathML, and SVG. Also affects dompurify
- CVE-2026-49458 DOMPurify is a DOM-only cross-site scripting sanitizer for HTML, MathML, and SVG. Also affects dompurify
- CVE-2026-47423 DOMPurify is a DOM-only cross-site scripting sanitizer for HTML, MathML, and SVG. Also affects dompurify
- GHSA-cmwh-pvxp-8882 DOMPurify: Permanent `ALLOWED_ATTR` pollution via `setConfig()` bypassing the hook… Also affects dompurify
- GHSA-vxr8-fq34-vvx9 DOMPurify: Trusted Types policy survives `clearConfig()` and can poison later… Also affects dompurify
- GHSA-gvmj-g25r-r7wr DOMPurify: SAFE_FOR_TEMPLATES bypass - template expressions survive sanitization inside… Also affects dompurify
- GHSA-rp9w-3fw7-7cwq DOMPurify IN_PLACE Sanitization Bypass via Attached Shadow Root Inside .content Also affects dompurify