CVE-2020-26870: Cross-site Scripting in dompurify

dompurify Updated 02 Oct 2025

Summary

18/12/2020
Yes i
Moderate
6.1

CVE-2020-26870: Cross-site Scripting in dompurify. Affects dompurify versions < 2.0.17. Fixed in 2.0.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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Dompurify is an npm package that provides a DOM sanitizer to prevent cross-site scripting (XSS) attacks. It is commonly used to sanitize user-generated content before rendering it in web applications. However, versions before 2.0.17 of Dompurify are vulnerable to a mutation XSS attack. This occurs when a serialize-parse roundtrip does not return the original DOM tree, leading to a change in namespace from HTML to MathML. An attacker can exploit this vulnerability by nesting FORM elements, potentially allowing them to execute malicious scripts in the context of the affected user's browser.

Vulnerability Detail

The vulnerability in Dompurify allows for cross-site scripting attacks, which can have severe consequences for web applications. By injecting malicious scripts into the rendered content, an attacker can steal sensitive user information, manipulate the application's behavior, or perform actions on behalf of the user. This vulnerability has a CVSS score of 6.1, indicating a moderate severity level.

How To Fix

Latest published version: 3.4.17 as of 22 Oct 2026

npm install dompurify@3.4.17

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

2.0.17

This is the first release that contains the fix.

npm install dompurify@2.0.17

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

Workaround

There is no known workaround for this vulnerability. It is essential to upgrade to the fixed version of Dompurify to mitigate the risk of cross-site scripting attacks.

Conclusion

In conclusion, the Dompurify package before version 2.0.17 is vulnerable to cross-site scripting attacks. It is crucial for developers to upgrade to the fixed version to mitigate the risk of exploitation. By following the recommended steps and keeping dependencies up to date, you can ensure the security of your web application. For additional support, please contact DevNack.com.

See every vulnerability recorded for dompurify →

Share this vulnerability

FAQ

Cross-site scripting (XSS) is a type of security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users. These scripts can be used to steal sensitive information, manipulate the page's content, or perform actions on behalf of the user.

If your application uses an older version of Dompurify (before 2.0.17), it is susceptible to cross-site scripting attacks. An attacker can exploit this vulnerability to inject and execute malicious scripts in the context of your application's users, potentially leading to unauthorized access, data theft, or other malicious activities.

While specific exploits targeting this vulnerability have not been disclosed publicly, it is crucial to address the issue promptly by upgrading to the fixed version of Dompurify. By doing so, you can prevent potential attacks and ensure the security of your application.

The vulnerability is specific to the Dompurify package. However, it is always recommended to keep all dependencies up to date to mitigate the risk of other vulnerabilities that may impact your application.

For further support and assistance in remediating this vulnerability, you can reach out to info@devnack.com. Our team of experts will be happy to assist you in securing your application.

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

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

2.0.17

This is the first release that contains the fix.

npm install dompurify@2.0.17

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