sanitize-html is vulnerable to XSS through incomprehensive sanitization
- Severity:
- Medium
Description
sanitize-html
prior to version 2.0.0-beta is vulnerable to Cross-site Scripting (XSS). The sanitizeHtml()
function in index.js
does not sanitize content when using the custom transformTags
option, which is intended to convert attribute values into text. As a result, malicious input can be transformed into executable code.
Recommendation
Update the sanitize-html
package to the latest compatible version. Followings are version details:
- Affected version(s): < 2.0.0-beta
- Patched version(s): 2.0.0-beta
References
Related Issues
- Bootstrap Cross-Site Scripting (XSS) vulnerability for data-* attributes - CVE-2024-6485
- nuxt vulnerable to Cross-site Scripting in navigateTo if used after SSR - CVE-2024-34343
- Vega vulnerable to Cross-site Scripting via RegExp.prototype[@@replace] - CVE-2025-27793
- @intlify/shared Prototype Pollution vulnerability (GHSA-hjwq-mjwj-4x6c) - CVE-2024-52810
- Tags:
- npm
- sanitize-html
Anything's wrong? Let us know Last updated on September 12, 2025