Medium

Cross-Site Scripting in dompurify

  • Disclosed: 28.08.2020
  • Updated: 11.10.2026 10:22

Versions of dompurify prior to 2.0.3 are vulnerable to Cross-Site Scripting (XSS). The package has an XSS filter bypass due to Mutation XSS in both Chrome and Safari through a combination of <svg>/<math> elements and </p>/</br>. An example payload is: <svg></p><style><a id="</style><img src=1 onerror=alert(1)>">. This allows attackers to bypass the XSS protection and execute arbitrary JavaScript in a victim's browser.

Recommendation

Upgrade to version 2.0.3 or later. You may also disallow <svg> and <math> through dompurify configurations:

dompurify
     FORBID_TAGS: ['svg', 'math']
 });```

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
npm package dompurify < 2.0.3 2.0.3

References

CVSS score 6.1/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness (CWE)
CWE-79
Platform
npm
Package
dompurify
Disclosed
28.08.2020
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-chqj-j4fh-rw7m - CC BY 4.0

Vulnerability history: dompurify

All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (30) in the archive
Total entries
30
First → latest
08.2020 10.2026
Without a fix
1
Exploited in attacks
0

Severity breakdown

  • Critical 2
  • High 3
  • Medium 19
  • Low 6

Disclosures per year

  1. 2020: 3
  2. 2021: 0
  3. 2022: 0
  4. 2023: 1
  5. 2024: 3
  6. 2025: 1
  7. 2026: 22
Severity:
  1. High · 8.2 CVE-2026-47423 >= 3.4.4, < 3.4.5 3.4.5
  2. Critical · 9.1 CVE-2024-48910 < 2.4.2 2.4.2
  3. High · 10.0 CVE-2024-47875 < 2.5.0, >= 3.0.0, < 3.1.3 2.5.0, 3.1.3
  4. High · 7.0 CVE-2024-45801 < 2.5.4, >= 3.0.0, < 3.1.3 2.5.4, 3.1.3
  5. Critical ghsa-mjjq-c88q-qhr6 < 2.0.7 2.0.7
  6. Cross-Site Scripting in dompurify this entry
    Medium · 6.1 CVE-2019-16728 < 2.0.3 2.0.3

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.