CVE-2026-63670: ApostropheCMS: Mutation-XSS / allowedTags bypass via literal `</textarea/>` solidus close
Summary A mutation-XSS / allowedTags bypass: when textarea (or xmp) is included in allowedTags, an input containing a literal (a solidus right after the RCDATA end-tag name) lets non-allowed markup such as pass through sanitizeHtml() live and unescaped, even though img/onerror are not in the allowlist. A spec-compliant browser executes the surviving handler — XSS.
Published Sep 3, 2026
Affected packages
sanitize-html
- Ecosystem
- npm
- Affected
- <= 2.17.5
- Fixed in
- 2.17.6
- Check
npm ls sanitize-html
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
A 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 ` 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.
Details
sanitize-html emits the text content of HTML raw-text elements (textarea, xmp) without escaping. Two things combine:
- Parser differential: on input, htmlparser2 does NOT recognize
</textarea/>(solidus after the RCDATA end-tag name) as a close tag; it emits</textarea/>as a single raw-text node. - Unescaped passthrough: the
ontexthandler (index.js~575-583) appendstextarea/xmpcontent with
result += text (no escapeHtml), assuming it is "already properly encoded" — true for entity-decoded content (what CVE-2026-40186 fixed) but false for this mis-tokenized literal close tag. A spec browser treats </textarea/> as a valid textarea close, so the following ` 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.
PoC
// npm i [email protected] parse5 && node poc.js
const sanitizeHtml = require('sanitize-html');
const input = '<textarea></textarea/>';
const opts = { allowedTags: sanitizeHtml.defaults.allowedTags.concat(['textarea']) }; // img NOT allowed
console.log(sanitizeHtml(input, opts));
// => <textarea></textarea/></textarea>
// the survives live and unescaped
console.log(sanitizeHtml(input)); // default config (no textarea allowed) => "" (safe)Re-parsing the sanitized OUTPUT with parse5 (the WHATWG HTML parser browsers/jsdom use) yields a live `` 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.
Impact
Cross-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.
Credited to bibu123456.
References
- https://github.com/apostrophecms/apostrophe/security/advisories/GHSA-jxwj-j7wr-gfrw
- https://nvd.nist.gov/vuln/detail/CVE-2026-63670
- https://github.com/apostrophecms/apostrophe/pull/5501
- https://github.com/apostrophecms/apostrophe/commit/eae1fb2b72ec5d1c27d0977509c6482a0408f725
- https://github.com/advisories/GHSA-jxwj-j7wr-gfrw
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More npm vulnerabilities
All npm entriesCVE-2026-113650
ApostropheCMS sanitize-html: unbounded recursion when re-sanitizing the fallback of a discarded iframe (stack overflow, nestingLimit not enforced)
medium5.3Oct 21, 2026CVE-2026-113654
ApostropheCMS sanitize-html: nonTextTags discard region ends early on an implied close, letting <noscript> content render
medium5.3Oct 20, 2026CVE-2026-113657
ApostropheCMS sanitize-html: SMIL animation namespace-prefix bypass allows javascript: URI injection (XSS)
low3.7Oct 20, 2026CVE-2026-113661
ApostropheCMS: Incomplete CVE-2026-53606: `meta http-equiv=refresh` `content` still ships `javascript:` / `data:` URLs
medium5.4Oct 20, 2026CVE-2026-84371
ApostropheCMS: Stored XSS via SVG SMIL URI-list scheme-policy bypass
medium5.4Sep 1, 2026CVE-2026-53606
sanitize-html has incomplete URI scheme validation in that allows javascript: URIs through action, formaction, data, poster, and background attributes
medium5.4Jul 31, 2026
