CVE-2019-25225: sanitize-html XSS vulnerability in custom transformTags

CVE-2019-25225 · Severity: low · CVSS 3.1 · Published 2025-09-08

sanitize-html is a JavaScript library used to clean and validate HTML content, commonly employed by web applications to prevent malicious code injection. The library fails to properly sanitize HTML attributes when using custom tag transformation options, allowing an attacker to inject malicious JavaScript that executes in a victim's browser when they visit a compromised page.

Technologies: sanitize-html (npm). Vendors: npm.

Quick answers

Is CVE-2019-25225 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2019-25225 being exploited in the wild.
How severe is CVE-2019-25225?
Low severity, with a CVSS score of 3.1, published 8 September 2025.
Which products and versions are affected?
sanitize-html (npm) SEMVER:introduced=0,fixed=2.0.0-beta.
Is there a fix for CVE-2019-25225?
Yes. sanitize-html (npm): upgrade to 2.0.0-beta or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2019-25225 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2019-25225?
Check whether you run sanitize-html (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • sanitize-html (npm): upgrade to 2.0.0-beta or later
    npm install sanitize-html@2.0.0-beta

Technical details

sanitize-html prior to version 2.0.0-beta is vulnerable to Stored or Reflected Cross-Site Scripting (XSS) due to incomplete attribute sanitization in the transformTags feature. The opentag function in index.js does not apply sanitization filters to attribute values when custom tag transformations are enabled, which are intended to convert attribute values into text. An attacker can supply malicious JavaScript code in HTML attributes that passes through the unsanitized code path, resulting in arbitrary JavaScript execution. The vulnerability requires the application to use custom transformTags and place user input into HTML attributes. A fix is available in version 2.0.0-beta and later.

Affected products

  • ApostropheCMS sanitize-html prior to 2.0.0-beta

Identifiers

  • CVE-2019-25225
  • GHSA-qhxp-v273-g94h

Timeline

  • 2025-09-08: disclosed: Advisory published
  • 2025-09-12: advisory: GitHub advisory database reviewed

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.