GHSA-c6gr-qvv4-5v3f: DOMPurify XHTML-mode SVG sanitization allows click-triggered XSS

dompurify Updated 22 Oct 2026

Summary

22/10/2026
LOW
Yes i
Low
Not published

GHSA-c6gr-qvv4-5v3f: A crafted SVG can execute script in the application’s origin when a user clicks a sanitized link under a specific XHTML configuration. Affects dompurify versions < 3.4.17. Fixed in 3.4.17. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

DOMPurify is an HTML sanitization package in the npm ecosystem. It sanitizes markup before applications insert it into a page, helping prevent unsafe content from executing. Developers use it to process user-provided HTML and SVG, with parser settings and allowlists that control which markup and attributes remain in the sanitized output.

Vulnerability Detail

This flaw can cause click-triggered cross-site scripting in applications that sanitize SVG using XHTML mode and allow specific animation tags and attributes. In application/xhtml+xml mode, the case-sensitive attributeName spelling bypasses a guard intended to remove attributes that can rewrite an SVG link’s href. An attacker can use an allowed animation to change a parent link to a script URL; clicking the link runs script in the application’s origin. Default configurations and text/html mode are not affected.

How To Fix

Latest published version: 3.4.17 as of 22 Oct 2026

npm install dompurify@3.4.17

The newest release already contains this fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

AI-generated workaround (not vendor-documented): Until upgrading dompurify, disable XHTML parsing for untrusted SVG or remove animation tags and attributeName from the allowlist. If XHTML mode is required, reject those elements and attributes before sanitization.

Documented mitigation:

<animate attributeName=\"href\" values=\"x;javascript:alert(1)\">

Conclusion

Bottom line: upgrade dompurify to 3.4.17. The issue requires a non-default XHTML configuration that allows SVG animation elements and attributeName; default configurations and text/html mode are not affected. Review applications that sanitize SVG in XHTML mode and remove the relevant allowlist entries until the upgrade is applied. Vulert monitors the dependencies in package-lock.json and alerts when a new vulnerability affects them; check an application at https://vulert.com/scanner.

See every vulnerability recorded for dompurify →

Share this vulnerability

FAQ

dompurify versions through 3.4.16 are affected; the published affected range begins at version 0.

An attacker can trigger script execution in the application’s origin when a user clicks a crafted sanitized SVG link under the affected configuration.

Upgrade dompurify to the minimum fixed version, 3.4.17.

Disable XHTML parsing for untrusted SVG or remove animation tags and attributeName from dompurify’s allowlist until upgrading.

Check package-lock.json for dompurify. Vulert can scan a manifest or SBOM and monitor the dependency at Vulert Scanner.

Related vulnerabilities

Recent vulnerabilities recorded for dompurify.

How To Fix

Latest published version: 3.4.17 as of 22 Oct 2026

npm install dompurify@3.4.17

The newest release already contains this fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback