Quick answers
- Is CVE-2026-40186 exploited in the wild?
- No. Junglewise Threat Intelligence has no report of CVE-2026-40186 being exploited in the wild.
- How severe is CVE-2026-40186?
- Medium severity, with a CVSS score of 6.1, published 15 April 2026.
- Which products and versions are affected?
- sanitize-html (npm) >= 2.17.2, < 2.17.3, SEMVER:introduced=2.17.2,fixed=2.17.3.
- Is there a fix for CVE-2026-40186?
- Yes. sanitize-html (npm): upgrade to 2.17.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
- How is CVE-2026-40186 attacked?
- It is attacked over the network, in a software library.
- Am I affected by CVE-2026-40186?
- Check whether you run ApostropheCMS, ApostropheCMS Sanitize-Html or sanitize-html (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.
How to fix
- sanitize-html (npm): upgrade to 2.17.3 or later
npm install sanitize-html@2.17.3
Technical details
A regression introduced in commit 49d0bb7 causes sanitize-html to skip HTML escaping for text content within elements defined in nonTextTagsArray (specifically <textarea> and <option>). The library incorrectly assumes that the underlying parser (htmlparser2) does not decode entities in these contexts; however, htmlparser2 10.x does decode them. Consequently, an attacker can provide entity-encoded payloads (e.g., <script>) which are decoded by the parser and then written directly to the output without being re-escaped. This allows for complete bypass of the allowedTags enforcement and enables stored XSS. The vulnerability is present in version 2.17.2 and is fixed in version 2.17.3.
Affected products
- apostrophecms sanitize-html >= 2.17.2, < 2.17.3
Identifiers
- CVE-2026-40186
- GHSA-9mrh-v2v3-xpfm
Timeline
- 2026-04-15: disclosed
- 2026-04-15: patched
- 2026-04-16: advisory