Vulnerability library
Security checkSeptember 12, 2025

sanitize-html is vulnerable to XSS through incomprehensive sanitization

Understand the exposure, see the recommended fix, and check whether your own website has related weaknesses.

Medium severitynpmsanitize-html

Check your website

Find this and other vulnerabilities with a free scan.

Your scan runs on your computer. No account required.

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

Could your website be exposed too?

SmartScanner can check your website for sanitize-html is vulnerable to XSS through incomprehensive sanitization and gives you actionable findings to investigate.

Start a free scan

Related Issues

See something that needs correcting? Let us knowUpdated September 12, 2025