Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-40186

CVE-2026-40186: ApostropheCMS sanitize-html XSS Vulnerability

CVE-2026-40186 is an XSS vulnerability in the ApostropheCMS sanitize-html package that bypasses tag filtering through entity encoding in textarea and option elements. This article covers technical details, affected versions, and patches.

Published: April 17, 2026

CVE-2026-40186 Overview

CVE-2026-40186 is a Cross-Site Scripting (XSS) vulnerability affecting ApostropheCMS and its sanitize-html package dependency. A regression introduced in commit 49d0bb7 (included in sanitize-html version 2.17.1) bypasses the allowedTags enforcement mechanism for text inside nonTextTagsArray elements, specifically textarea and option tags. This allows attackers to inject arbitrary HTML and JavaScript through entity-encoded payloads, completely circumventing the sanitization protections.

Critical Impact

Attackers can inject arbitrary XSS payloads through allowed option or textarea elements using entity encoding, enabling session hijacking, credential theft, and malicious content injection on affected CMS platforms and form builders.

Affected Products

  • ApostropheCMS version 4.28.0 (through dependency on vulnerable sanitize-html)
  • sanitize-html package versions 2.17.1 and prior to 2.17.2
  • Node.js applications using affected sanitize-html versions with option or textarea in allowedTags

Discovery Timeline

  • 2026-04-15 - CVE-2026-40186 published to NVD
  • 2026-04-15 - Last updated in NVD database

Technical Details for CVE-2026-40186

Vulnerability Analysis

The vulnerability stems from an incorrect assumption about how htmlparser2 version 10.x handles entity decoding inside raw text elements. The vulnerable code at packages/sanitize-html/index.js:569-573 assumed that htmlparser2 does not decode entities inside elements like textarea and option, and therefore skipped escaping for text content within these tags. However, htmlparser2 10.x actually does decode entities before passing text to the ontext callback.

This behavioral change in the parser library created a critical security gap: entity-encoded HTML sequences (e.g., <script>) are first decoded by the parser into literal HTML characters (<script>), then written directly to the output without sanitization. The allowedTags filter is completely bypassed because the malicious tags are encoded during input but become active HTML in the output.

Root Cause

The root cause is a flawed assumption in the sanitize-html library about the behavior of its underlying HTML parser. The code incorrectly treated all tags in nonTextTagsArray (including option) as raw text elements that preserve entity encoding, when in fact only textarea and xmp are true raw text elements in htmlparser2. The option element's content is decoded by the parser, meaning entity-encoded payloads like <script>alert(1)</script> become executable HTML after parsing.

Attack Vector

The attack requires a non-default configuration where option or textarea elements are included in allowedTags, which is common in form builders and CMS platforms that allow user-generated forms. An attacker can craft input containing entity-encoded malicious HTML within these allowed elements. When the input passes through the vulnerable sanitize-html function, the entity encoding is decoded by the parser but not re-escaped, resulting in XSS execution in the victim's browser.

javascript
         // your concern, don't allow them. The same is essentially true for style tags
         // which have their own collection of XSS vectors.
         result += text;
-      } else if ((options.disallowedTagsMode === 'discard' || options.disallowedTagsMode === 'completelyDiscard') && (nonTextTagsArray.indexOf(tag) !== -1)) {
-        // htmlparser2 does not decode entities inside raw text elements like
-        // textarea and option. The text is already properly encoded, so pass
-        // it through without additional escaping to avoid double-encoding.
+      } else if ((options.disallowedTagsMode === 'discard' || options.disallowedTagsMode === 'completelyDiscard') && (tag === 'textarea' || tag === 'xmp')) {
+        // htmlparser2 treats <textarea> and <xmp> as raw text elements and
+        // does NOT decode entities inside them. The text is already properly
+        // encoded, so pass it through without additional escaping to avoid
+        // double-encoding. Other "nonTextTags" like <option> are not raw text
+        // elements in htmlparser2, so their contents are decoded and must be
+        // escaped below like any other text (important to prevent XSS via
+        // entity-encoded payloads such as <option><script>...</script></option>).
         result += text;
       } else if (!addedText) {
         const escaped = escapeHtml(text, false);

Source: GitHub Commit

Detection Methods for CVE-2026-40186

Indicators of Compromise

  • Presence of entity-encoded HTML sequences within option or textarea elements in user-submitted content (e.g., <script>, <img, <svg)
  • Unexpected JavaScript execution or DOM modifications on pages displaying user-generated content
  • Web application logs showing unusual form submissions containing encoded HTML entities in select options or text areas
  • Browser console errors related to Content Security Policy violations from inline script attempts

Detection Strategies

  • Implement Web Application Firewall (WAF) rules to detect entity-encoded XSS payloads within form fields, particularly targeting option and textarea content
  • Deploy Content Security Policy (CSP) headers with strict inline script restrictions to detect and block XSS execution attempts
  • Review application dependencies for vulnerable sanitize-html versions (2.17.1 and earlier before the fix)
  • Audit server-side logs for submissions containing patterns like <script or <script within form data

Monitoring Recommendations

  • Enable verbose logging on form submission endpoints to capture raw input data for security analysis
  • Monitor for CSP violation reports that may indicate XSS exploitation attempts
  • Set up dependency scanning to alert on vulnerable package versions in your Node.js applications
  • Implement real-time monitoring for anomalous JavaScript execution patterns in user-facing content areas

How to Mitigate CVE-2026-40186

Immediate Actions Required

  • Upgrade sanitize-html package to version 2.17.2 or later immediately
  • Upgrade ApostropheCMS to version 4.29.0 or later if using the full CMS platform
  • Review any custom allowedTags configurations that include option or textarea elements and assess exposure
  • Audit recently submitted user content for potential exploitation attempts

Patch Information

The vulnerability has been patched in sanitize-html version 2.17.2 and ApostropheCMS version 4.29.0. The fix modifies the text handling logic to only skip escaping for true raw text elements (textarea and xmp), while properly escaping content in option elements and other non-raw-text tags. For detailed patch information, see the GitHub Security Advisory and patch commit.

Workarounds

  • Remove option from your allowedTags configuration if it is not strictly required for your application's functionality
  • Implement additional server-side input validation that decodes and re-validates content before passing to sanitize-html
  • Deploy Content Security Policy headers with script-src restrictions to limit the impact of any successful XSS injection
  • Consider implementing a secondary sanitization pass using an alternative library until the patch can be applied
bash
# Upgrade sanitize-html to patched version
npm update sanitize-html@2.17.2

# Or for ApostropheCMS users, upgrade the full platform
npm update apostrophe@4.29.0

# Verify the installed version
npm list sanitize-html

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechApostrophecms

  • SeverityMEDIUM

  • CVSS Score6.1

  • EPSS Probability0.03%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityLow
  • AvailabilityNone
  • CWE References
  • CWE-79
  • Technical References
  • GitHub Commit Update

  • GitHub Security Advisory GHSA-9mrh-v2v3-xpfm
  • Related CVEs
  • CVE-2026-33889: ApostropheCMS Stored XSS Vulnerability

  • CVE-2026-35569: ApostropheCMS Stored XSS Vulnerability

  • CVE-2026-39857: ApostropheCMS Auth Bypass Vulnerability

  • CVE-2026-33888: ApostropheCMS Authorization Bypass Flaw
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English