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-41240

CVE-2026-41240: DOMPurify XSS Vulnerability

CVE-2026-41240 is a cross-site scripting vulnerability in DOMPurify that allows forbidden elements to bypass sanitization. This post covers the technical details, affected versions, impact, and mitigation steps.

Published: April 23, 2026

CVE-2026-41240 Overview

DOMPurify, a widely-used DOM-only cross-site scripting (XSS) sanitizer for HTML, MathML, and SVG, contains a vulnerability in versions prior to 3.4.0 that allows forbidden elements to bypass sanitization. The flaw stems from an inconsistency between FORBID_TAGS and FORBID_ATTR handling when function-based ADD_TAGS is used, potentially enabling XSS attacks in applications relying on DOMPurify for input sanitization.

Critical Impact

Attackers can bypass the FORBID_TAGS security mechanism, allowing forbidden HTML elements to survive sanitization with their attributes intact, potentially leading to Cross-Site Scripting attacks.

Affected Products

  • DOMPurify versions prior to 3.4.0
  • Applications using DOMPurify with EXTRA_ELEMENT_HANDLING.tagCheck configurations
  • Web applications relying on FORBID_TAGS for XSS protection

Discovery Timeline

  • 2026-04-23 - CVE CVE-2026-41240 published to NVD
  • 2026-04-23 - Last updated in NVD database

Technical Details for CVE-2026-41240

Vulnerability Analysis

This vulnerability (CWE-79: Cross-Site Scripting) arises from a logic flaw in DOMPurify's tag filtering mechanism. The issue was introduced when commit c361baa added an early exit optimization for FORBID_ATTR at line 1214, but the same protective fix was not consistently applied to FORBID_TAGS handling.

The core problem exists at lines 1118-1123 in the DOMPurify source code. When EXTRA_ELEMENT_HANDLING.tagCheck returns true, JavaScript's short-circuit evaluation causes the FORBID_TAGS check to be skipped entirely. This means that elements explicitly forbidden by the application's security policy can pass through the sanitization process unfiltered, along with their potentially malicious attributes.

Root Cause

The root cause is an inconsistent implementation of security checks between FORBID_ATTR and FORBID_TAGS when using function-based ADD_TAGS configuration. The FORBID_ATTR handling includes an early exit mechanism that prevents bypasses, but the FORBID_TAGS logic lacks this same protection. When the tagCheck function returns a truthy value, the logical OR (||) operator causes short-circuit evaluation, preventing the subsequent FORBID_TAGS validation from executing.

Attack Vector

An attacker can exploit this vulnerability by crafting HTML input containing elements that are listed in FORBID_TAGS but can pass the EXTRA_ELEMENT_HANDLING.tagCheck function. When DOMPurify processes this input:

  1. The tagCheck function evaluates the element
  2. If tagCheck returns true, short-circuit evaluation occurs
  3. The FORBID_TAGS check is never executed
  4. The forbidden element survives sanitization with attributes intact
  5. This can lead to XSS execution if the forbidden element contains event handlers or script content
javascript
/* Parse profile info */
if (USE_PROFILES) {
  ALLOWED_TAGS = addToSet({}, text);
-      ALLOWED_ATTR = [];
+      ALLOWED_ATTR = create(null);
  if (USE_PROFILES.html === true) {
    addToSet(ALLOWED_TAGS, html$1);
    addToSet(ALLOWED_ATTR, html);

Source: GitHub Commit c361baa

Detection Methods for CVE-2026-41240

Indicators of Compromise

  • Unexpected HTML elements appearing in sanitized output that should have been blocked by FORBID_TAGS
  • XSS payloads executing in applications using DOMPurify with custom EXTRA_ELEMENT_HANDLING configurations
  • Web application firewall logs showing unusual HTML tag combinations in POST requests

Detection Strategies

  • Review application code for DOMPurify configurations using EXTRA_ELEMENT_HANDLING.tagCheck in combination with FORBID_TAGS
  • Implement automated testing to verify that all FORBID_TAGS elements are properly blocked regardless of tagCheck results
  • Audit JavaScript dependencies using npm audit or similar tools to identify vulnerable DOMPurify versions

Monitoring Recommendations

  • Monitor content security policy (CSP) violation reports for inline script execution attempts
  • Enable verbose logging on input sanitization functions to detect unexpected element passthrough
  • Set up dependency scanning in CI/CD pipelines to alert on vulnerable DOMPurify versions

How to Mitigate CVE-2026-41240

Immediate Actions Required

  • Upgrade DOMPurify to version 3.4.0 or later immediately
  • Audit all DOMPurify configurations using EXTRA_ELEMENT_HANDLING with FORBID_TAGS
  • Implement additional input validation layers until patching is complete
  • Review recent user-generated content for potential exploitation attempts

Patch Information

The vulnerability is addressed in DOMPurify version 3.4.0. The patch ensures consistent handling between FORBID_TAGS and FORBID_ATTR by preventing short-circuit evaluation from bypassing forbidden element checks. The fix modifies the ALLOWED_ATTR initialization to use create(null) instead of an empty array, and adds proper checks to prevent the tagCheck short-circuit bypass.

For detailed patch information, see the GitHub Security Advisory GHSA-h7mw-gpvr-xq4m and the DOMPurify 3.4.0 Release.

Workarounds

  • Avoid using EXTRA_ELEMENT_HANDLING.tagCheck in combination with FORBID_TAGS until upgrade is possible
  • Implement server-side validation as a secondary layer of protection
  • Use Content Security Policy (CSP) headers to mitigate potential XSS impact
bash
# Upgrade DOMPurify via npm
npm update dompurify@3.4.0

# Verify installed version
npm list dompurify

# Audit for vulnerabilities
npm audit

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

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechDompurify

  • SeverityMEDIUM

  • CVSS Score6.0

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:H/VA:N/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
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityHigh
  • AvailabilityNone
  • CWE References
  • CWE-79
  • Technical References
  • GitHub Commit Update

  • GitHub Release 3.4.0

  • GitHub Security Advisory GHSA-h7mw-gpvr-xq4m
  • Related CVEs
  • CVE-2026-41238: DOMPurify Prototype Pollution XSS Vulnerability

  • CVE-2026-41239: DOMPurify XSS Vulnerability

  • CVE-2026-0540: Cure53 DOMPurify XSS Vulnerability

  • CVE-2024-48910: Cure53 DOMPurify XSS Vulnerability
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