Vulnerabilities in pkg:npm/sanitize-html
PACKAGECVE-2026-63670 is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting ApostropheCMS libraries in the npm ecosystem. The issue involves mutation-xss / allowedtags bypass via literal `</textarea/>` solidus close. Remediation is available by upgrading affected packages to version 2.17.6.
pkg:npm/sanitize-html
Vulnerability advisories affecting package pkg:npm/sanitize-html. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-jxwj-j7wr-gfrw | CVE-2026-63670 | MODERATE | ApostropheCMS: Mutation-XSS / allowedTags bypass via literal `</textarea/>` solidus close |
| GHSA-g8qq-57p8-ggw5 | CVE-2026-84371 | MODERATE | ApostropheCMS: Stored XSS via SVG SMIL URI-list scheme-policy bypass |
| GHSA-vccv-cmxp-4j9h | CVE-2026-53606 | MODERATE | sanitize-html has incomplete URI scheme validation in that allows javascript: URIs through action, formaction, data, poster, and background attributes |
| GHSA-rpr9-rxv7-x643 | CVE-2026-44990 | CRITICAL | Apostrophe has default XSS via `xmp` raw-text passthrough in `sanitize-html` |
| GHSA-9mrh-v2v3-xpfm | CVE-2026-40186 | MODERATE | sanitize-html allowedTags Bypass via Entity-Decoded Text in nonTextTags Elements |
| GHSA-qhxp-v273-g94h | CVE-2019-25225 | MODERATE | sanitize-html is vulnerable to XSS through incomprehensive sanitization |
| GHSA-rm97-x556-q36h | CVE-2024-21501 | MODERATE | sanitize-html Information Exposure vulnerability |
| GHSA-cgfm-xwp7-2cvr | CVE-2022-25887 | HIGH | Sanitize-html Vulnerable To REDoS Attacks |
| GHSA-wg96-3933-j2w5 | CVE-2017-16017 | MODERATE | Cross-Site Scripting in sanitize-html |
| GHSA-xc6g-ggrc-qq4r | CVE-2017-16016 | MODERATE | Cross-Site Scripting in sanitize-html |
| GHSA-rjqq-98f6-6j3r | CVE-2021-26539 | MODERATE | Improper Input Validation in sanitize-html |
| GHSA-3j7m-hmh3-9jmp | CVE-2016-1000237 | MODERATE | Cross-Site Scripting in sanitize-html |
| GHSA-mjxr-4v3x-q3m4 | CVE-2021-26540 | MODERATE | Improper Input Validation in sanitize-html |
CVE-2026-63670 at a Glance
Security Impact
CVSS: 6.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).
How to Fix CVE-2026-63670
To remediate this vulnerability, upgrade all affected ApostropheCMS dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install sanitize-html@2.17.6
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls sanitize-html
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-63670, inspect your project dependencies using npm:
npm ls sanitize-html
Analyze the terminal output to locate any version of ApostropheCMS in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.17.6), your application is affected.
Note: The npm ls sanitize-html command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In ApostropheCMS, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-63670 Affected ApostropheCMS Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
sanitize-html
|
npm |
< 2.17.6
|
2.17.6
|
References
Frequently Asked Questions
What is CVE-2026-63670?
Which ApostropheCMS versions are affected?
What version fixes CVE-2026-63670?
Is sanitize-html affected?
What is the CVSS score of CVE-2026-63670?
What CWE is associated with CVE-2026-63670?
How can I check npm dependencies for CVE-2026-63670?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-jxwj-j7wr-gfrw",
"modified" : "2026-09-03T20:07:16Z",
"published" : "2026-09-03T20:07:16Z",
"aliases" : [ "CVE-2026-63670" ],
"summary" : "ApostropheCMS: Mutation-XSS / allowedTags bypass via literal `</textarea/>` solidus close",
"details" : "### Summary\nA mutation-XSS / allowedTags bypass: when `textarea` (or `xmp`) is included in `allowedTags`, an input containing a literal `</textarea/>` (a solidus right after the RCDATA end-tag name) lets non-allowed markup such as `<img src=x onerror=…>` pass through `sanitizeHtml()` **live and unescaped**, even though `img`/`onerror` are not in the allowlist. A spec-compliant browser executes the surviving handler — XSS. This is a literal-solidus variant that bypasses the two most recent fixes in this code area (CVE-2026-40186, CVE-2026-44990), both already applied in 2.17.5. The default configuration is not affected.\n\n### Details\n`sanitize-html` emits the text content of HTML raw-text elements (`textarea`, `xmp`) without escaping. Two things combine:\n- **Parser differential:** on input, htmlparser2 does NOT recognize `</textarea/>` (solidus after the RCDATA\n end-tag name) as a close tag; it emits `</textarea/><img …>` as a single raw-text node.\n- **Unescaped passthrough:** the `ontext` handler (`index.js` ~575-583) appends `textarea`/`xmp` content with\n`result += text` (no `escapeHtml`), assuming it is \"already properly encoded\" — true for entity-decoded\n content (what CVE-2026-40186 fixed) but false for this mis-tokenized literal close tag.\nA spec browser treats `</textarea/>` as a valid `textarea` close, so the following `<img onerror>` is parsed as a live element. The recent fixes addressed entity-encoding (CVE-2026-40186) and the `xmp` default (CVE-2026-44990); neither covers the literal-solidus mis-tokenization, so the raw passthrough still leaks.\n\n### PoC\n```js\n// npm i sanitize-html@2.17.5 parse5 && node poc.js\nconst sanitizeHtml = require('sanitize-html');\nconst input = '<textarea></textarea/><img src=x onerror=\"alert(document.domain)\">';\nconst opts = { allowedTags: sanitizeHtml.defaults.allowedTags.concat(['textarea']) }; // img NOT allowed\nconsole.log(sanitizeHtml(input, opts));\n// => <textarea></textarea/><img src=x onerror=\"alert(document.domain)\"></textarea>\n// the <img onerror> survives live and unescaped\n\nconsole.log(sanitizeHtml(input)); // default config (no textarea allowed) => \"\" (safe)\n```\nRe-parsing the sanitized OUTPUT with **parse5** (the WHATWG HTML parser browsers/jsdom use) yields a **live\n`<img src=x onerror=alert(document.domain)>`** at `body` level (it escaped the textarea RCDATA, not inert text) → the `onerror` fires in a browser. Confirmed on 2.17.5 (Node v24). A canonical `poc.js` is attached.\n<img width=\"650\" height=\"118\" alt=\"image\" src=\"https://github.com/user-attachments/assets/d63bb5b7-ba3e-4b0e-a821-86a453ea0352\" />\n\n### Impact\nCross-site scripting (CWE-79). Requires `textarea` (or `xmp`) in `allowedTags` — a benign-looking, common addition in form builders, CMS, and rich-text editors. Adding a harmless tag that then enables XSS via *non-allowed* `img`/`onerror` breaks the sanitizer's core contract; the maintainers have fixed this class before (e.g. GHSA-9mrh). An attacker who can submit content rendered through such a configuration achieves stored/reflected XSS (cookie theft, session hijack). Severity Medium (default config is safe; user interaction to view the page). **Suggested fix:** route `textarea`/`xmp` content through `escapeHtml` instead of the raw passthrough, and/or fix the htmlparser2 `</tag/>` RCDATA end-tag tokenization to match the WHATWG spec.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "sanitize-html"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.17.6"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 2.17.5"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/apostrophecms/apostrophe/security/advisories/GHSA-jxwj-j7wr-gfrw"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-63670"
}, {
"type" : "WEB",
"url" : "https://github.com/apostrophecms/apostrophe/pull/5501"
}, {
"type" : "WEB",
"url" : "https://github.com/apostrophecms/apostrophe/commit/eae1fb2b72ec5d1c27d0977509c6482a0408f725"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/apostrophecms/apostrophe"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-09-03T20:07:16Z",
"nvd_published_at" : "2026-08-17T20:16:45Z"
}
}