{"id":"CVE-2026-113654","aliases":["CLSA-2026-1793810745","EUVD-2026-105182","GHSA-x3q4-9hxx-gx8m"],"status":"published","title":"ApostropheCMS sanitize-html: nonTextTags discard region ends early on an implied close, letting \u003cnoscript\u003e content render","description":"ApostropheCMS is an open-source Node.js content management system, and sanitize-html provides a simple HTML sanitizer with a clear API. Prior to sanitize-html 2.18.0, a non-default nonTextTags configuration that includes noscript can end its discard region early when htmlparser2 emits an implied ancestor close inside noscript. Because scripting-enabled browsers treat noscript content as raw text while the parser does not model that mode, content intended to remain inert can survive sanitization and render; the issue does not generalize to every default nonTextTags element. This issue is fixed in sanitize-html 2.18.0.","severity":{"version":"4.0","score":5.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N","level":"medium","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-12","score":0.00432,"percentile":0.37951,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-79"],"published":"2026-10-20T16:35:55Z","modified":"2026-11-04T19:00:37Z","fixes":[{"ecosystem":"npm","package":"sanitize-html","fixed_in":["2.18.0"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"sanitize-html","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.18.0"}]}]},{"source":"osv","ecosystem":"TuxCare:npm","package":"sanitize-html","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"1.27.5-tuxcare.0"},{"fixed":"1.27.5-tuxcare.8"}]}],"versions":["1.27.5","1.27.5-tuxcare.1","1.27.5-tuxcare.2","1.27.5-tuxcare.3","1.27.5-tuxcare.4","1.27.5-tuxcare.5","1.27.5-tuxcare.6","1.27.5-tuxcare.7"],"bundled":2},{"source":"osv","ecosystem":"npm","package":"sanitize-html","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"2.18.0"}]}]}],"products":[{"vendor":"apostrophecms","product":"apostrophe"},{"vendor":"apostrophecms","product":"sanitize-html"}],"references":[{"url":"https://github.com/apostrophecms/apostrophe/security/advisories/GHSA-x3q4-9hxx-gx8m","tags":["x_refsource_CONFIRM","exploit","advisory","web"]},{"url":"https://github.com/apostrophecms/apostrophe/commit/9500b8b0e1d630d5e07fbb5fd2c25ed0943845ce","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/apostrophecms/apostrophe/commit/f84fd41cbf6c22eb8d0008fc9c25df1f7130b350","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/apostrophecms/apostrophe/releases/tag/sanitize-html@2.18.0","tags":["x_refsource_MISC","web"]},{"url":"https://github.com/advisories/GHSA-x3q4-9hxx-gx8m"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/113xxx/CVE-2026-113654.json","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-113654","tags":["advisory"]},{"url":"https://github.com/apostrophecms/apostrophe","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-113654","title":"ApostropheCMS sanitize-html: nonTextTags discard region ends early on an implied close, letting \u003cnoscript\u003e content render","description":"ApostropheCMS is an open-source Node.js content management system, and sanitize-html provides a simple HTML sanitizer with a clear API. Prior to sanitize-html 2.18.0, a non-default nonTextTags configuration that includes noscript can end its discard region early when htmlparser2 emits an implied ancestor close inside noscript. Because scripting-enabled browsers treat noscript content as raw text while the parser does not model that mode, content intended to remain inert can survive sanitization and render; the issue does not generalize to every default nonTextTags element. This issue is fixed in sanitize-html 2.18.0.","status":"published","published":"2026-10-20T16:35:55.161Z","modified":"2026-10-28T14:01:09.403Z","cvss":[{"version":"4.0","score":5.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N","level":"medium","assessor":"cna"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T13:44:29.519518Z"}],"euvd":[{"id":"EUVD-2026-105182","description":"ApostropheCMS is an open-source Node.js content management system, and sanitize-html provides a simple HTML sanitizer with a clear API. Prior to sanitize-html 2.18.0, a non-default nonTextTags configuration that includes noscript can end its discard region early when htmlparser2 emits an implied ancestor close inside noscript. Because scripting-enabled browsers treat noscript content as raw text while the parser does not model that mode, content intended to remain inert can survive sanitization and render; the issue does not generalize to every default nonTextTags element. This issue is fixed in sanitize-html 2.18.0.","status":"published","published":"2026-10-20T16:35:55Z","modified":"2026-10-28T14:01:09Z","cvss":[{"version":"4.0","score":5.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N","level":"medium"}],"updated_at":"2026-11-02T16:59:20.750321Z"}],"ghsa":[{"id":"GHSA-x3q4-9hxx-gx8m","title":"ApostropheCMS sanitize-html: nonTextTags discard region ends early on an implied close, letting \u003cnoscript\u003e content render","description":"## Summary\n\n`sanitize-html` discards the *content* of every element in `nonTextTags`. It delimits that region\nusing htmlparser2's close events, and ignores the `isImplied` flag htmlparser2 passes it. Closing a\nstill-open **ancestor** from inside a `\u003cnoscript\u003e` makes htmlparser2 unwind its stack past the\n`noscript`; the synthetic implied close it emits on the way ends the discard region early, and\neverything after it is treated as ordinary body content.\n\nA browser with scripting enabled parses `\u003cnoscript\u003e` content as **raw text**, so the same markup\nrenders as inert text there. The sanitizer therefore emits elements the page itself would not have.\n\n## Reproduction\n\n```js\nconst sanitizeHtml = require(\"sanitize-html\");\n\nsanitizeHtml('\u003cdiv\u003e\u003cnoscript\u003e\u003c/div\u003e\u003cimg src=\"http://evil.test/t.gif\"\u003e\u003c/noscript\u003e', {\n  allowedTags: [\"div\", \"img\"],\n  allowedAttributes: { img: [\"src\"] },\n  nonTextTags: [\"script\", \"style\", \"textarea\", \"option\", \"noscript\"],\n});\n// =\u003e '\u003cdiv\u003e\u003c/div\u003e\u003cimg src=\"http://evil.test/t.gif\" /\u003e'\n```\n\nChrome, given the same input, renders **no** `\u003cimg\u003e` — the whole payload is raw text inside the\nunclosed `\u003cnoscript\u003e`. Verified with Playwright, `srcdoc` into an iframe so the scripting flag is on.\n\nA `\u003c![CDATA[` variant hides the opening tag from the parser entirely and has the same effect:\n\n```\n\u003cp\u003eHi\u003c/p\u003e\u003c![CDATA[ x \u003e \u003cnoscript\u003e]]\u003e\u003ca href=\"…\"\u003eReset your password\u003c/a\u003e\u003cimg src=\"…beacon.gif\"\u003e\u003c/noscript\u003e\n```\n\nhtmlparser2 runs a CDATA token to `]]\u003e`; Chrome ends a bogus comment at the first `\u003e`, so the\n`\u003cnoscript\u003e` after it is real to the browser and invisible to the parser.\n\n## Where the behaviour is\n\n`index.js`:\n\n- `:154` — `nonTextTagsArray` (the default list, `['script','style','textarea','option','xmp']`).\n- `:638` — `onclosetag: function (name, isImplied)` — receives the flag.\n- `:644` — `skipTextDepth--` — decrements without consulting `isImplied`.\n\n## Suggested fix\n\nDo not end a discard region on an implied close. htmlparser2 already distinguishes them; the flag\nis passed and discarded. Something close to:\n\n```js\nonclosetag: function (name, isImplied) {\n  if (skipText) {\n    if (isImplied) return;   // an implied close must not end the region\n    skipTextDepth--;\n    …\n```","status":"published","published":"2026-10-20T18:03:22Z","modified":"2026-10-20T18:03:24Z","cvss":[{"version":"4.0","score":5.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:41:33.669646Z"}],"nvd":[{"id":"CVE-2026-113654","description":"ApostropheCMS is an open-source Node.js content management system, and sanitize-html provides a simple HTML sanitizer with a clear API. Prior to sanitize-html 2.18.0, a non-default nonTextTags configuration that includes noscript can end its discard region early when htmlparser2 emits an implied ancestor close inside noscript. Because scripting-enabled browsers treat noscript content as raw text while the parser does not model that mode, content intended to remain inert can survive sanitization and render; the issue does not generalize to every default nonTextTags element. This issue is fixed in sanitize-html 2.18.0.","status":"published","published":"2026-10-20T17:17:36.37Z","modified":"2026-10-28T14:16:56.73Z","cvss":[{"version":"4.0","score":5.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","level":"medium","assessor":"secondary"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:13:01.161484Z"}],"osv":[{"id":"CVE-2026-113654","title":"ApostropheCMS sanitize-html: nonTextTags discard region ends early on an implied close, letting \u003cnoscript\u003e content render","description":"ApostropheCMS is an open-source Node.js content management system, and sanitize-html provides a simple HTML sanitizer with a clear API. Prior to sanitize-html 2.18.0, a non-default nonTextTags configuration that includes noscript can end its discard region early when htmlparser2 emits an implied ancestor close inside noscript. Because scripting-enabled browsers treat noscript content as raw text while the parser does not model that mode, content intended to remain inert can survive sanitization and render; the issue does not generalize to every default nonTextTags element. This issue is fixed in sanitize-html 2.18.0.","status":"published","published":"2026-10-20T16:35:55.161Z","modified":"2026-11-11T10:47:24.944315725Z","cvss":[{"version":"4.0","score":5.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-11T03:22:00.901153Z"},{"id":"GHSA-x3q4-9hxx-gx8m","title":"ApostropheCMS sanitize-html: nonTextTags discard region ends early on an implied close, letting \u003cnoscript\u003e content render","description":"## Summary\n\n`sanitize-html` discards the *content* of every element in `nonTextTags`. It delimits that region\nusing htmlparser2's close events, and ignores the `isImplied` flag htmlparser2 passes it. Closing a\nstill-open **ancestor** from inside a `\u003cnoscript\u003e` makes htmlparser2 unwind its stack past the\n`noscript`; the synthetic implied close it emits on the way ends the discard region early, and\neverything after it is treated as ordinary body content.\n\nA browser with scripting enabled parses `\u003cnoscript\u003e` content as **raw text**, so the same markup\nrenders as inert text there. The sanitizer therefore emits elements the page itself would not have.\n\n## Reproduction\n\n```js\nconst sanitizeHtml = require(\"sanitize-html\");\n\nsanitizeHtml('\u003cdiv\u003e\u003cnoscript\u003e\u003c/div\u003e\u003cimg src=\"http://evil.test/t.gif\"\u003e\u003c/noscript\u003e', {\n  allowedTags: [\"div\", \"img\"],\n  allowedAttributes: { img: [\"src\"] },\n  nonTextTags: [\"script\", \"style\", \"textarea\", \"option\", \"noscript\"],\n});\n// =\u003e '\u003cdiv\u003e\u003c/div\u003e\u003cimg src=\"http://evil.test/t.gif\" /\u003e'\n```\n\nChrome, given the same input, renders **no** `\u003cimg\u003e` — the whole payload is raw text inside the\nunclosed `\u003cnoscript\u003e`. Verified with Playwright, `srcdoc` into an iframe so the scripting flag is on.\n\nA `\u003c![CDATA[` variant hides the opening tag from the parser entirely and has the same effect:\n\n```\n\u003cp\u003eHi\u003c/p\u003e\u003c![CDATA[ x \u003e \u003cnoscript\u003e]]\u003e\u003ca href=\"…\"\u003eReset your password\u003c/a\u003e\u003cimg src=\"…beacon.gif\"\u003e\u003c/noscript\u003e\n```\n\nhtmlparser2 runs a CDATA token to `]]\u003e`; Chrome ends a bogus comment at the first `\u003e`, so the\n`\u003cnoscript\u003e` after it is real to the browser and invisible to the parser.\n\n## Where the behaviour is\n\n`index.js`:\n\n- `:154` — `nonTextTagsArray` (the default list, `['script','style','textarea','option','xmp']`).\n- `:638` — `onclosetag: function (name, isImplied)` — receives the flag.\n- `:644` — `skipTextDepth--` — decrements without consulting `isImplied`.\n\n## Suggested fix\n\nDo not end a discard region on an implied close. htmlparser2 already distinguishes them; the flag\nis passed and discarded. Something close to:\n\n```js\nonclosetag: function (name, isImplied) {\n  if (skipText) {\n    if (isImplied) return;   // an implied close must not end the region\n    skipTextDepth--;\n    …\n```","status":"published","published":"2026-10-20T18:03:22Z","modified":"2026-10-20T18:15:04.513263654Z","cvss":[{"version":"4.0","score":5.3,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:46:59.484835Z"},{"id":"CLSA-2026-1793810745","title":"TuxCare security update for sanitize-html (2 CVEs)","description":"TuxCare rebuilt sanitize-html to address 2 CVEs. Fixed in 1.27.5-tuxcare.8.","status":"published","published":"2026-11-04T17:45:46Z","modified":"2026-11-04T19:00:37.295303512Z","updated_at":"2026-11-04T19:15:03.6858Z"}]}}
