Skip to main content

@xmldom/xmldom EUVDEUVD-2026-28289

| CVE-2026-41674 HIGH
XML Injection (aka Blind XPath Injection) (CWE-91)
2026-04-22 https://github.com/xmldom/xmldom GHSA-f6ww-3ggp-fr8h
8.7
CVSS 4.0 · Vendor: https://github.com/xmldom/xmldom
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Submit crafted metadata to document generation API
  2. Delivery
    Application calls createDocumentType with attacker-controlled publicId/systemId/internalSubset
  3. Exploit
    XMLSerializer emits DOCTYPE with injected markup verbatim
  4. Execution
    Downstream parser processes serialized XML
  5. Persist
    Injected entities expanded or markup interpreted
  6. Impact
    XXE data exfiltration or script execution in transformation output

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization XPath query parameterization
Exploitation Conditions

Exploitation requires four specific conditions: (1) Application must use @xmldom/xmldom or legacy xmldom package for XML document construction. (2) Code must programmatically call DOMImplementation.createDocumentType(qualifiedName, publicId, systemId, internalSubset) passing attacker-controlled data in publicId, systemId, or internalSubset parameters, OR directly write attacker-controlled values to DocumentType node properties after creation-the parsing path via DOMParser is explicitly safe per advisory. (3) Application must serialize the resulting document using XMLSerializer.serializeToString() without the {requireWellFormed: true} option flag. (4) For XXE impact specifically, a downstream XML parser must re-parse the serialized output with external entity expansion enabled (not a default configuration in most modern parsers). Conditions that limit exploitation: input validation on DocumentType parameters, use of requireWellFormed flag in patched versions, downstream parsers with entity expansion disabled, or use of parsing APIs rather than programmatic document construction. The advisory explicitly states 'The parse path is safe: the SAX parser enforces the PubidLiteral and SystemLiteral grammar productions'. Network access is not a limiting factor per CVSS AV:N-vulnerable code can be reached via any API accepting document metadata. No authentication required (PR:N). No user interaction required (UI:N) once prerequisites are met.

Impact

Real-world risk is moderate despite the high CVSS 8.7 score. CVSS vector CVSS:4.0/AV:N/AC:L/PR:N/UI:N indicates network-reachable unauthenticated exploitation with low complexity, but multiple limiting factors constrain practical impact. No public exploit identified at time of analysis and not confirmed actively exploited (CISA KEV). EPSS score not provided in input data, preventing quantitative exploitation probability assessment. Attack prerequisites significantly limit exposure: the vulnerable code path requires applications to (1) programmatically call createDocumentType() with attacker-controlled arguments rather than parsing XML from untrusted sources (parsing path is safe per advisory), (2) serialize the resulting document via XMLSerializer.serializeToString(), and (3) pass that serialized output to a downstream XML parser configured to expand external entities. This is not a default configuration for most XML processing pipelines. The CVSS vector lacks Scope Changed indicator, suggesting contained impact within the vulnerable component. SSVC exploitation status is 'proof of concept' (working PoC in advisory), automatable is 'yes' (once prerequisites are met, no user interaction required), technical impact is 'partial' (integrity violation via markup injection, not arbitrary code execution in xmldom itself-downstream XXE is a chained risk). Comparison: high CVSS reflects theoretical worst-case network attack vector, but narrow attack surface (programmatic API misuse rather than default parsing workflow) and requirement for specific downstream parser misconfiguration reduce real-world likelihood. Primary risk is to applications that build XML documents from user input and re-parse serialized output with entity expansion enabled-a pattern more common in server-side data transformation pipelines than client applications. Key uncertainty: patch adoption rate is unknown since fix requires explicit opt-in flag rather than automatic protection, potentially leaving many deployments vulnerable indefinitely.

Exploit ScenarioDerived

Developer builds a document transformation service that accepts user-supplied metadata for XML document generation. Attacker submits a malicious systemId value '"http://trusted.example"><script xmlns='http://www.w3.org/1999/xhtml'>alert(document.domain)</script><![CDATA[' via API parameter. Application calls impl.createDocumentType('root', '', attackerSystemId, '') and serializes result with new XMLSerializer().serializeToString(doc). Serialized output contains <!DOCTYPE root SYSTEM "http://trusted.example"><script xmlns='http://www.w3.org/1999/xhtml'>alert(document.domain)</script><![CDATA[><root/> where injected script element appears as document sibling outside DOCTYPE context. Downstream XML-to-HTML transformer parses this output and renders the injected script in user's browser. Publicly available exploit code exists in advisory proof-of-concept demonstrating all three injection vectors with working Node.js examples.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv2 – May 07, 2026

XML injection in @xmldom/xmldom XMLSerializer allows remote attackers to inject arbitrary markup into serialized DOCTYPE declarations by crafting malicious DocumentType node properties (internalSubset, publicId, systemId). When applications programmatically create DocumentType nodes with attacker-controlled data via createDocumentType() and serialize the result, the serializer emits these fields verbatim without escaping or validation. Three distinct injection vectors exist: internalSubset containing ']>' terminates the DOCTYPE early; publicId containing quoted strings injects fake SYSTEM entities; systemId containing '>' breaks the declaration boundary. Downstream XML parsers re-parsing the serialized output may expand injected entities, enabling XXE attacks. No public exploit identified at time of analysis. EPSS data not provided. Vendor-released patch requires opt-in: applications must explicitly pass {requireWellFormed: true} to serializeToString() to enable validation guards; default behavior remains vulnerable to preserve backward compatibility with DOM Parsing spec.

Earlier versions of this analysis (1)
v1 Apr 23, 2026 - 06:51

DOCTYPE declaration injection in @xmldom/xmldom allows attackers to inject arbitrary XML markup and malicious SYSTEM entities into serialized output. When applications pass untrusted data to createDocumentType() or set DocumentType properties (publicId, systemId, internalSubset) without validation, XMLSerializer.serializeToString() emits these values verbatim, enabling early closure of DOCTYPE declarations and injection of external entity references. Downstream parsers that re-parse the serialized output with entity expansion enabled become vulnerable to XXE attacks. Public exploit code exists (PoC in GitHub advisory). Vendor-released patches require explicit opt-in via {requireWellFormed: true} flag - default behavior remains vulnerable for backward compatibility.

RemediationAI

Vendor-released patch available in @xmldom/xmldom versions 0.8.13 and 0.9.10 (commit 372008f9ae0e20fd69f761c7b79e202598267314). Critical: protection is opt-in only-existing code remains vulnerable unless modified. Upgrade to patched version and explicitly pass {requireWellFormed: true} as second argument to XMLSerializer.serializeToString(node, {requireWellFormed: true}). This enables validation guards that throw InvalidStateError if DocumentType properties contain injection sequences: publicId must match XML PubidLiteral production (XML 1.0 [12]), systemId must match SystemLiteral production ([11]), and internalSubset must not contain ']>'. Default behavior without the flag preserves verbatim serialization for backward compatibility with DOM Parsing spec §3.2.1.3. Users of legacy xmldom package (unscoped) must migrate to @xmldom/xmldom as no fix exists for the legacy codebase. Compensating controls if immediate upgrade is infeasible: (1) Input validation-reject or sanitize user-controlled data before passing to createDocumentType(), specifically blocking characters ']>', '"', and '>' in respective fields; trade-off is potential false positives rejecting legitimate identifiers. (2) Output validation-validate serialized XML against XML schema before downstream processing; adds processing overhead and latency. (3) Disable external entity expansion in all downstream XML parsers consuming serialized output (set XMLReader features http://xml.org/sax/features/external-general-entities and external-parameter-entities to false); prevents XXE but does not prevent markup injection itself. (4) Avoid programmatic DocumentType construction entirely-parse DOCTYPE from trusted sources only; limits application functionality requiring dynamic document generation. Advisory and patch references: https://github.com/xmldom/xmldom/security/advisories/GHSA-f6ww-3ggp-fr8h and https://github.com/xmldom/xmldom/commit/372008f9ae0e20fd69f761c7b79e202598267314.

Affected VersionsENISA

xmldom @xmldom/xmldom 0.9.0, < 0.9.10
xmldom @xmldom/xmldom < 0.8.13
xmldom xmldom ≤ 0.6.0

Affected Packages

npm @xmldom/xmldom fix: 0.8.13, 0.9.10
npm xmldom no fix
euvd xmldom_xmldom no fix
euvd xmldom_xmldom_xmldom fix: 0.8.13, 0.9.10

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 4 packages in npm, euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The vulnerability resides in @xmldom/xmldom, a JavaScript implementation of W3C DOM Level 2 Core and DOM Parsing and Serialization specifications for Node.js and browsers. The DOMImplementation.createDocumentType() method validates only the qualifiedName parameter against the XML QName production (xmlns-related naming rules) but stores publicId, systemId, and internalSubset arguments verbatim without enforcing XML grammar constraints. The XMLSerializer subsequently emits these fields directly into the DOCTYPE declaration using string concatenation with no sanitization. Per XML 1.0 productions [11] SystemLiteral and [12] PubidLiteral, these identifiers must be properly quoted and contain restricted character sets, but the serializer does not enforce these constraints. The vulnerability is classified as CWE-91 (XML Injection, formerly Direct Dynamic Code Evaluation: 'Eval Injection'), a variant of CWE-74 Improper Neutralization of Special Elements in Output. Affected packages per CPE: npm/@xmldom/xmldom (scoped package, actively maintained fork) and npm/xmldom (legacy unscoped package, deprecated, unfixed). The W3C DOM Parsing spec §3.2.1.3 defines a requireWellFormed flag with default false, permitting verbatim serialization when unset-this spec behavior is the root cause enabling the injection.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/xmldom/xmldom) PRIMARY 8.7 HIGH
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N
SUSE 7.5 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Red Hat 7.5 HIGH

Primary rating from Vendor (https://github.com/xmldom/xmldom).

CVSS VectorVendor: https://github.com/xmldom/xmldom

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
High
Vulnerable system: Availability
None
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

4
Analysis Updated
May 07, 2026 - 04:49 vuln.today
v2 - CVSS changed
CVSS changed
May 07, 2026 - 04:35 NVD
8.7 (HIGH)
Patch released
Apr 22, 2026 - 20:31 nvd
Patch available
CVE Published
Apr 22, 2026 - 20:19 nvd
HIGH

DescriptionCVE.org

Summary

The package serializes DocumentType node fields (internalSubset, publicId, systemId) verbatim without any escaping or validation. When these fields are set programmatically to attacker-controlled strings, XMLSerializer.serializeToString can produce output where the DOCTYPE declaration is terminated early and arbitrary markup appears outside it.

---

Details

DOMImplementation.createDocumentType(qualifiedName, publicId, systemId, internalSubset) validates only qualifiedName against the XML QName production. The remaining three arguments are stored as-is with no validation.

The XMLSerializer emits DocumentType nodes as:

<!DOCTYPE name[ PUBLIC pubid][ SYSTEM sysid][ [internalSubset]]>

All fields are pushed into the output buffer verbatim - no escaping, no quoting added.

internalSubset injection: The serializer wraps internalSubset with [ and ]. A value containing ]> closes the internal subset and the DOCTYPE declaration at the injection point. Any content after ]> in internalSubset appears outside the DOCTYPE in the serialized output as raw XML markup. Reported by @TharVid (GHSA-f6ww-3ggp-fr8h). Affected: @xmldom/xmldom ≥ 0.9.0 via createDocumentType API; 0.8.x only via direct property write.

publicId injection: The serializer emits publicId verbatim after PUBLIC with no quoting added. A value containing an injected system identifier (e.g., "pubid" SYSTEM "evil") breaks the intended quoting context, injecting a fake SYSTEM entry into the serialized DOCTYPE declaration. Identified during internal security research. Affected: both branches, all versions back to 0.1.0.

systemId injection: The serializer emits systemId verbatim. A value containing > terminates the DOCTYPE declaration early; content after > appears as raw XML markup outside the DOCTYPE context. Identified during internal security research. Affected: both branches, all versions back to 0.1.0.

The parse path is safe: the SAX parser enforces the PubidLiteral and SystemLiteral grammar productions, which exclude the relevant characters, and the internal subset parser only accepts a subset it can structurally validate. The vulnerability is reachable only through programmatic createDocumentType calls with attacker-controlled arguments.

---

Affected code

lib/dom.js - createDocumentType (lines 898-910):

js
createDocumentType: function (qualifiedName, publicId, systemId, internalSubset) {
    validateQualifiedName(qualifiedName);          // only qualifiedName is validated
    var node = new DocumentType(PDC);
    node.name = qualifiedName;
    node.nodeName = qualifiedName;
    node.publicId = publicId || '';               // stored verbatim
    node.systemId = systemId || '';               // stored verbatim
    node.internalSubset = internalSubset || '';   // stored verbatim
    node.childNodes = new NodeList();
    return node;
},

lib/dom.js - serializer DOCTYPE case (lines 2948-2964):

js
case DOCUMENT_TYPE_NODE:
    var pubid = node.publicId;
    var sysid = node.systemId;
    buf.push(g.DOCTYPE_DECL_START, ' ', node.name);
    if (pubid) {
        buf.push(' ', g.PUBLIC, ' ', pubid);
        if (sysid && sysid !== '.') {
            buf.push(' ', sysid);
        }
    } else if (sysid && sysid !== '.') {
        buf.push(' ', g.SYSTEM, ' ', sysid);
    }
    if (node.internalSubset) {
        buf.push(' [', node.internalSubset, ']');  // internalSubset emitted verbatim
    }
    buf.push('>');
    return;

---

PoC

internalSubset injection

js
const { DOMImplementation, XMLSerializer } = require('@xmldom/xmldom');

const impl = new DOMImplementation();
const doctype = impl.createDocumentType(
    'root',
    '',
    '',
    ']><injected/><![CDATA['
);
const doc = impl.createDocument(null, 'root', doctype);
const xml = new XMLSerializer().serializeToString(doc);
console.log(xml);
// <!DOCTYPE root []><injected/><![CDATA[]><root/>
//                   ^^^^^^^^^^  injected element outside DOCTYPE

publicId quoting context break

js
const { DOMImplementation, XMLSerializer } = require('@xmldom/xmldom');

const impl = new DOMImplementation();
const doctype = impl.createDocumentType(
    'root',
    '"injected PUBLIC_ID" SYSTEM "evil"',
    '',
    ''
);
const doc = impl.createDocument(null, 'root', doctype);
console.log(new XMLSerializer().serializeToString(doc));
// <!DOCTYPE root PUBLIC "injected PUBLIC_ID" SYSTEM "evil"><root/>
// quoting context broken - SYSTEM entry injected

systemId injection

js
const { DOMImplementation, XMLSerializer } = require('@xmldom/xmldom');

const impl = new DOMImplementation();
const doctype = impl.createDocumentType(
    'root',
    '',
    '"sysid"><injected attr="pwn"/>',
    ''
);
const doc = impl.createDocument(null, 'root', doctype);
console.log(new XMLSerializer().serializeToString(doc));
// <!DOCTYPE root SYSTEM "sysid"><injected attr="pwn"/>><root/>
// > in sysid closes DOCTYPE early; <injected/> appears as sibling element

---

Impact

An application that programmatically constructs DocumentType nodes from user-controlled data and then serializes the document can emit a DOCTYPE declaration where the internal subset is closed early or where injected SYSTEM entities or other declarations appear in the serialized output.

Downstream XML parsers that re-parse the serialized output and expand entities from the injected DOCTYPE declarations may be susceptible to XXE-class attacks if they enable entity expansion.

---

Fix Applied

> ⚠ Opt-in required. Protection is not automatic. Existing serialization calls remain > vulnerable unless { requireWellFormed: true } is explicitly passed. Applications that pass > untrusted data to createDocumentType() or write untrusted values directly to a > DocumentType node's publicId, systemId, or internalSubset properties should audit > all serializeToString() call sites and add the option.

XMLSerializer.serializeToString() now accepts an options object as a second argument. When { requireWellFormed: true } is passed, the serializer validates the DocumentType node's publicId, systemId, and internalSubset fields before emitting the DOCTYPE declaration and throws InvalidStateError if any field contains an injection sequence:

  • publicId: throws if non-empty and does not match the XML PubidLiteral production (XML 1.0 [12])
  • systemId: throws if non-empty and does not match the XML SystemLiteral production (XML 1.0 [11])
  • internalSubset: throws if it contains ]> (which closes the internal subset and DOCTYPE declaration early)

All three checks apply regardless of how the invalid value entered the node - whether via createDocumentType arguments or a subsequent direct property write.

PoC - fixed path

js
const { DOMImplementation, XMLSerializer } = require('@xmldom/xmldom');
const impl = new DOMImplementation();

// internalSubset injection
const dt1 = impl.createDocumentType('root', '', '', ']><injected/><![CDATA[');
const doc1 = impl.createDocument(null, 'root', dt1);

// Default (unchanged): verbatim - injection present
console.log(new XMLSerializer().serializeToString(doc1));
// <!DOCTYPE root []><injected/><![CDATA[]><root/>

// Opt-in guard: throws InvalidStateError
try {
  new XMLSerializer().serializeToString(doc1, { requireWellFormed: true });
} catch (e) {
  console.log(e.name, e.message);
  // InvalidStateError: DocumentType internalSubset contains "]>"
}

The guard also covers post-creation property writes:

js
const dt2 = impl.createDocumentType('root', '', '');
dt2.systemId = '"sysid"><injected attr="pwn"/>';
const doc2 = impl.createDocument(null, 'root', dt2);
new XMLSerializer().serializeToString(doc2, { requireWellFormed: true });
// InvalidStateError: DocumentType systemId is not a valid SystemLiteral

Why the default stays verbatim

The W3C DOM Parsing and Serialization spec §3.2.1.3 defines a require well-formed flag whose default value is false. With the flag unset, the spec permits verbatim serialization of DOCTYPE fields. Unconditionally throwing would be a behavioral breaking change with no spec justification. The opt-in requireWellFormed: true flag allows applications that require injection safety to enable strict mode without breaking existing deployments.

Residual limitation

createDocumentType(qualifiedName, publicId, systemId[, internalSubset]) does not validate publicId, systemId, or internalSubset at creation time. This creation-time validation is a breaking change and is deferred to a future breaking release.

When the default serialization path is used (without requireWellFormed: true), all three fields are still emitted verbatim. Applications that do not pass requireWellFormed: true remain exposed.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 4 npm packages depend on @xmldom/xmldom (4 direct, 0 indirect)
  • 2,019 npm packages depend on xmldom (864 direct, 1,181 indirect)

Ecosystem-wide dependent count for version 0.9.0 and other introduced versions.

Executive ViewAI

Why It Matters

The @xmldom/xmldom library contains a high-severity XML injection vulnerability in its serializer that allows attackers to inject malicious markup into DOCTYPE declarations when applications process untrusted DocumentType data. Organizations using this library risk XXE (XML External Entity) attacks if serialized XML is re-parsed downstream, potentially leading to data exfiltration, denial of service, or remote code execution depending on parser configuration.

Business Impact: High
Compensating Controls

Apply vendor patch. Until patched: (1) avoid passing user-controlled data to createDocumentType() parameters (internalSubset, publicId, systemId); (2) sanitize or reject DOCTYPE declarations in input validation logic; (3) configure downstream XML parsers to disable entity expansion and external entity resolution; (4) isolate XML processing in sandboxed environments with restricted network access.

Threat Intelligence Overview

EPSS Score
0.0%
Top 85% exploitable
Threat Intel
1
1 sources
Data Quality
7 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact
High

Priority Score

44
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +44
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

XML External Entity (XXE) attacks exploit XML parsers that process Document Type Definitions (DTDs) without proper restrictions.

Vendor StatusVendor

SUSE

Severity: High
Product Status
SUSE Linux Enterprise Desktop 15 SP7 Fixed
SUSE Linux Enterprise High Performance Computing 15 SP7 Fixed
SUSE Linux Enterprise Module for Python 3 15 SP7 Fixed
SUSE Linux Enterprise Server 15 SP7 Fixed
SUSE Linux Enterprise Server for SAP Applications 15 SP7 Fixed

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy