Improper Encoding or Escaping of Output Affecting sanitize-html package, versions <2.17.4


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JS-SANITIZEHTML-16759743
  • published29 May 2026
  • disclosed14 May 2026
  • creditMuhammadUwais

Introduced: 14 May 2026

NewCVE-2026-45011  (opens in a new tab)
CWE-116  (opens in a new tab)
CWE-79  (opens in a new tab)

How to fix?

Upgrade sanitize-html to version 2.17.4 or higher.

Overview

sanitize-html is a library that allows you to clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis

Affected versions of this package are vulnerable to Improper Encoding or Escaping of Output via the linkHref field handling. An attacker can execute arbitrary JavaScript by supplying a javascript: URL in an image widget's link URL field and having it rendered on the page. This affects users who can edit content and allows an attacker to run a script in viewers’ browsers, exposing session data and enabling unauthorized actions on the affected site.

Workaround

Restrict who can edit or publish image widgets so untrusted users cannot set the Link to field to a javascript: URL; this prevents stored XSS from being published to pages viewed by others.

CVSS Base Scores

version 4.0
version 3.1