CVE-2026-113657: sanitize-html Package XSS Vulnerability via SMIL Animation Namespace-Prefix Bypass

sanitize-html Updated 21 Oct 2026

Summary

20/10/2026
Yes i
Low
3.7

CVE-2026-113657: sanitize-html 2.17.7 introduced animatesUrlAttribute() to block SVG animation elements (animate, animateColor, animateMotion, animateTransform, set) when their attributeName targets a URL sink like href. Affects sanitize-html versions >= 2.17.7, < 2.18.0. Fixed in 2.18.0. 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

The sanitize-html package is a widely used library in the Node.js ecosystem that allows developers to sanitize HTML content, ensuring that it is safe for use in web applications. It provides features to control which HTML tags and attributes are allowed, making it particularly useful for applications that handle user-generated content. However, a vulnerability was discovered in version 2.17.7 that affects its ability to properly sanitize SVG animations, leading to potential cross-site scripting (XSS) attacks.

Vulnerability Detail

The vulnerability arises from the introduction of the animatesUrlAttribute() function in sanitize-html 2.17.7, which was intended to block SVG animation elements targeting URL sinks. However, this protection can be bypassed when the animation element uses a namespace prefix, such as 'svg:animate'. The function fails to recognize the prefixed tag names, allowing attackers to inject JavaScript via SMIL animations. This can lead to XSS attacks, particularly when applications set allowedTags to false, which is common in rich-text editors that want to preserve SVG content.

How To Fix

Latest published version: 2.18.1 as of 23 Oct 2026

npm install sanitize-html@2.18.1

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.18.0

This is the first release that contains the fix.

npm install sanitize-html@2.18.0

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

Workaround

If immediate updating is not possible, a temporary workaround is to manually strip namespace prefixes from tag names in your sanitization logic. Here’s a code snippet to illustrate this:

const localTagName = 

name.

toLowerCase().slice(name.lastIndexOf(':') + 1);

if (svgAnimationTags.indexOf(localTagName) === -1) { /* handle the case */ }

Conclusion

The sanitize-html package has a vulnerability that allows for XSS attacks via SMIL animations when using namespace prefixes. It is crucial to update to version 2.18.0 or later to mitigate this risk. Additionally, developers can implement workarounds until they can apply the patch.

See every vulnerability recorded for sanitize-html →

Share this vulnerability

FAQ

The CVSS score of this vulnerability is 3.7, indicating a low severity level.

sanitize-html versions 2.17.7 and later are affected by this vulnerability.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. You can check your application using the Vulert playground without any signup.

This vulnerability can lead to cross-site scripting (XSS) attacks, allowing attackers to execute arbitrary JavaScript in the context of the user's browser.

Yes, you can implement a workaround by manually stripping namespace prefixes from tag names in your sanitization logic.

Related vulnerabilities

Recent vulnerabilities recorded for sanitize-html.

How To Fix

Latest published version: 2.18.1 as of 23 Oct 2026

npm install sanitize-html@2.18.1

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.18.0

This is the first release that contains the fix.

npm install sanitize-html@2.18.0

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