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.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| — | sanitize-html | < 2.0.0-beta | 2.0.0-beta |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | node-sanitize-html | No fix yet | — |
| Ubuntu 26.04 LTS | node-sanitize-html | No fix yet | — |
| Ubuntu 25.10 | node-sanitize-html | No fix yet | — |
| Ubuntu 24.04 LTS | node-sanitize-html | No fix yet | — |
| Ubuntu 22.04 LTS | node-sanitize-html | No fix yet | — |
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| npm | sanitize-html | < 2.0.0-beta | 2.0.0-beta | GHSA-qhxp-v273-g94h |
References
- https://github.com/apostrophecms/sanitize-html/issues/293 issue-tracking
- https://github.com/apostrophecms/sanitize-html/pull/156
- https://github.com/apostrophecms/sanitize-html/commit/712cb6895825c8bb6ede71a16b42bade42abcaf3 patch
- https://github.com/Checkmarx/Vulnerabilities-Proofs-of-Concept/tree/main/2019/CVE-2019-25225 exploit