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-2021-21366

CVE-2021-21366: Xmldom_project Xmldom XXE Vulnerability

CVE-2021-21366 is an XML External Entity (XXE) flaw in Xmldom_project Xmldom that fails to preserve system identifiers correctly. This article covers the technical details, affected versions, impact, and mitigation.

Published: February 25, 2026

CVE-2021-21366 Overview

CVE-2021-21366 is an input validation vulnerability affecting xmldom, a pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module widely used in Node.js applications. The vulnerability exists in xmldom versions 0.4.0 and older, where the library fails to correctly preserve system identifiers, FPIs (Formal Public Identifiers), or namespaces when repeatedly parsing and serializing maliciously crafted documents. This flaw can lead to unexpected syntactic changes during XML processing in downstream applications.

Critical Impact

Attackers can craft malicious XML documents that, when processed through affected xmldom versions, result in altered document structure potentially bypassing security controls or causing unexpected application behavior in downstream systems.

Affected Products

  • xmldom_project xmldom versions 0.4.0 and older (Node.js)
  • debian debian_linux 10.0

Discovery Timeline

  • 2021-03-12 - CVE-2021-21366 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-21366

Vulnerability Analysis

This vulnerability stems from improper handling of XML document components during the parse-serialize cycle. When xmldom processes maliciously crafted documents through multiple iterations of parsing and serialization, critical document metadata—including system identifiers, Formal Public Identifiers (FPIs), and namespace declarations—may not be correctly preserved. This interpretation discrepancy can cause the serialized output to differ syntactically from the original input in ways that downstream applications may not anticipate.

The security implications vary depending on how downstream applications process the modified XML output. Applications relying on document integrity or performing security-sensitive operations based on XML structure may be vulnerable to bypass attacks or data manipulation.

Root Cause

The root cause lies in the DOM serialization logic within lib/dom.js, where the handling of DOCTYPE declarations improperly processes public and system identifiers. The vulnerable code incorrectly wraps identifiers in quotation marks during serialization, leading to malformed output when documents are round-tripped through the parser and serializer.

Additionally, the error handling in lib/dom-parser.js contributed to the issue by not properly encapsulating parsing errors, which could mask malformed document handling during processing.

Attack Vector

The vulnerability is exploitable over the network, requiring user interaction. An attacker can craft a malicious XML document with specially formatted DOCTYPE declarations, system identifiers, or namespace constructs. When a vulnerable application parses and subsequently serializes this document (a common pattern in XML transformation pipelines), the output document will have altered syntax. This can be leveraged to:

  1. Bypass XML-based input validation that occurs before the parse-serialize cycle
  2. Inject or modify document structure in ways that affect downstream processing
  3. Cause application logic errors due to unexpected document structure changes
javascript
// Security patch in lib/dom.js - DOCTYPE serialization fix
// Before (vulnerable):
		var sysid = node.systemId;
		buf.push('<!DOCTYPE ',node.name);
		if(pubid){
			buf.push(' PUBLIC "',pubid);
			if (sysid && sysid!='.') {
				buf.push( '" "',sysid);
			}
			buf.push('">');
		}else if(sysid && sysid!='.'){
			buf.push(' SYSTEM "',sysid,'">');
		}

// After (fixed):
		var sysid = node.systemId;
		buf.push('<!DOCTYPE ',node.name);
		if(pubid){
			buf.push(' PUBLIC ', pubid);
			if (sysid && sysid!='.') {
				buf.push(' ', sysid);
			}
			buf.push('>');
		}else if(sysid && sysid!='.'){
			buf.push(' SYSTEM ', sysid, '>');
		}

Source: GitHub Commit d4201b9

javascript
// Security patch in lib/dom-parser.js - Error handling improvement
// Before (vulnerable):
	fatalError:function(error) {
		console.error('[xmldom fatalError]\t'+error,_locator(this.locator));
	    throw error;
	}

// After (fixed):
	fatalError:function(error) {
		throw new ParseError(error, this.locator);
	}

Source: GitHub Commit d4201b9

Detection Methods for CVE-2021-21366

Indicators of Compromise

  • Presence of xmldom package versions 0.4.0 or older in package.json or package-lock.json files
  • XML documents with unusual or malformed DOCTYPE declarations in application logs
  • Discrepancies between input and output XML documents after processing pipelines
  • Application errors related to unexpected XML namespace or identifier handling

Detection Strategies

  • Audit Node.js application dependencies using npm audit or yarn audit to identify vulnerable xmldom versions
  • Implement software composition analysis (SCA) tools to continuously monitor for vulnerable package versions
  • Review XML processing logs for syntactic inconsistencies between input and serialized output
  • Deploy application-level monitoring to detect anomalous XML document structure changes

Monitoring Recommendations

  • Configure dependency scanning in CI/CD pipelines to flag xmldom versions below 0.5.0
  • Monitor application logs for XML parsing errors or warnings related to DOCTYPE, namespace, or identifier processing
  • Implement integrity checks on XML documents before and after parse-serialize operations in security-sensitive workflows
  • Use SentinelOne Singularity Platform to monitor for suspicious XML processing patterns and supply chain vulnerabilities

How to Mitigate CVE-2021-21366

Immediate Actions Required

  • Upgrade xmldom to version 0.5.0 or later immediately
  • Audit all Node.js applications and dependencies for vulnerable xmldom versions
  • Implement input validation to reject potentially malicious XML documents before processing
  • Review XML processing workflows that involve repeated parsing and serialization

Patch Information

The vulnerability is fixed in xmldom version 0.5.0. The patch addresses the incorrect preservation of system identifiers, FPIs, and namespaces during the parse-serialize cycle. Organizations should update their dependencies by running:

bash
npm update xmldom

For specific version pinning:

bash
npm install xmldom@0.5.0

Refer to the GitHub Security Advisory GHSA-h6q6-9hqw-rwfv and Release Notes for v0.5.0 for complete details. Debian users should reference the Debian LTS Announcement for distribution-specific patches.

Workarounds

  • Implement strict input validation to reject XML documents with suspicious DOCTYPE declarations or identifiers before processing
  • Avoid repeated parse-serialize cycles on untrusted XML content where possible
  • Add integrity verification by comparing document hashes before and after processing to detect unexpected modifications
  • Consider using alternative XML parsing libraries if immediate upgrade is not feasible
bash
# Configuration example - Verify xmldom version and update
# Check current xmldom version
npm list xmldom

# Update to patched version
npm install xmldom@^0.5.0

# Verify the update
npm list xmldom

# Run security audit
npm audit --audit-level=moderate

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

  • Vulnerability Details
  • TypeXXE

  • Vendor/TechXmldom

  • SeverityMEDIUM

  • CVSS Score4.3

  • EPSS Probability0.57%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityLow
  • AvailabilityNone
  • CWE References
  • CWE-115

  • CWE-436
  • Technical References
  • GitHub Release v0.5.0

  • Debian LTS Announcement

  • NPM Package Information
  • Vendor Resources
  • GitHub Commit Update

  • GitHub Security Advisory GHSA-h6q6-9hqw-rwfv
  • Related CVEs
  • CVE-2026-34601: xmldom XML Injection Vulnerability

  • CVE-2022-39353: Xmldom_project Xmldom XXE Vulnerability

  • CVE-2021-32796: Xmldom_project Xmldom XXE Vulnerability

  • CVE-2022-37616: Xmldom Prototype Pollution 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