Junglewise Threat Intelligence

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

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

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

Executive brief

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.

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

Timeline

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

References

Related threats