# sanitize-html (npm)

Clean up user-submitted HTML, preserving allowlisted elements and allowlisted attributes on a per-element basis

- Latest: 2.18.2 (2026-11-11)
- Licence: MIT
- Downloads: 79756510 last month
- Advisories on the latest version: 0

- CVE-2026-113650 MODERATE: ApostropheCMS sanitize-html: unbounded recursion when re-sanitizing the fallback of a discarded iframe (stack overflow, nestingLimit not enforced) Fixed in 2.18.1.
- CVE-2026-113657 LOW: ApostropheCMS sanitize-html: SMIL animation namespace-prefix bypass allows javascript: URI injection (XSS) Fixed in 2.18.0.
- CVE-2026-113661 MODERATE: ApostropheCMS: Incomplete CVE-2026-53606: `meta http-equiv=refresh` `content` still ships `javascript:` / `data:` URLs Fixed in 2.18.0.
- CVE-2026-113654 MODERATE: ApostropheCMS sanitize-html: nonTextTags discard region ends early on an implied close, letting <noscript> content render Fixed in 2.18.0.
- CVE-2026-63670 MODERATE: ApostropheCMS: Mutation-XSS / allowedTags bypass via literal `</textarea/>` solidus close Fixed in 2.17.6.
- CVE-2026-84371 MODERATE: ApostropheCMS: Stored XSS via SVG SMIL URI-list scheme-policy bypass Fixed in 2.17.7.
- CVE-2026-53606 MODERATE: sanitize-html has incomplete URI scheme validation in that allows javascript: URIs through action, formaction, data, poster, and background attributes Fixed in 2.17.5.
- CVE-2026-44990 CRITICAL: Apostrophe has default XSS via `xmp` raw-text passthrough in `sanitize-html` Fixed in 2.17.4.
- CVE-2026-40186 MODERATE: sanitize-html allowedTags Bypass via Entity-Decoded Text in nonTextTags Elements Fixed in 2.17.3.
- CVE-2019-25225 MODERATE: sanitize-html is vulnerable to XSS through incomprehensive sanitization Fixed in 2.0.0-beta.
- CVE-2024-21501 MODERATE: sanitize-html Information Exposure vulnerability Fixed in 2.12.1.
- CVE-2022-25887 HIGH: Sanitize-html Vulnerable To REDoS Attacks Fixed in 2.7.1.
- CVE-2021-26540 MODERATE: Improper Input Validation in sanitize-html Fixed in 2.3.2.
- CVE-2021-26539 MODERATE: Improper Input Validation in sanitize-html Fixed in 2.3.1.
- CVE-2016-1000237 MODERATE: Cross-Site Scripting in sanitize-html Fixed in 1.4.3.
- CVE-2017-16017 MODERATE: Cross-Site Scripting in sanitize-html Fixed in 1.2.3.
- CVE-2017-16016 MODERATE: Cross-Site Scripting in sanitize-html Fixed in 1.11.4.

Sources: npm, deps.dev (CC BY 4.0), OSV. Last checked 4 Dec 2026.
