/

CVE-2026-34601

Severity:

HIGH RISK

(7.5)

XML Injection in xmldom DOMParser/XMLSerializer

CVE-2026-34601

Deferred

Vulnerability type

Category:

XML Injection

CWE:

CWE-91

Impact:

XML Structure Injection and Business Logic Manipulation

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

xmldom and @xmldom/xmldom allowed attacker-controlled strings containing the CDATA terminator sequence ]]> to be inserted into CDATASection nodes without sanitization or splitting.

When such nodes were serialized, the raw content was emitted verbatim, turning what should have been text-only data into active XML markup and enabling XML structure injection and manipulation of downstream business logic that consumes the XML.

Affected context

The vulnerability appears in applications that:

  • Use xmldom (≤ 0.6.0) or @xmldom/xmldom (prior to 0.8.12/0.9.9) for parsing and serializing XML, and
  • Insert attacker-controlled or otherwise untrusted data into CDATASection nodes, and
  • Rely on XMLSerializer output as a trusted XML document for later processing, persistence, or transmission.

In these cases, data that should remain inert text inside CDATA can be transformed into active XML structure when serialized, potentially affecting any component that later parses or interprets the XML.

Exploit preconditions

  • Attack surface: XML-based APIs, document generation pathways, or integrations that accept untrusted input and embed it into CDATA sections before serialization.
  • Required access: Ability to supply or influence the text content placed into CDATASection nodes (e.g., user input fields, external feed data, partner integrations).
  • Trigger point: Invocation of XMLSerializer on a DOM that holds a CDATASection containing the ]]> terminator sequence supplied by the attacker.
  • Why exploitation is possible: The serializer does not reject, escape, or safely split CDATA content containing the ]]> terminator. As a result, the emitted XML breaks out of the original CDATA, allowing the attacker-controlled data that follows to be interpreted as XML markup instead of plain text.

Why this happens

This issue stems from improper neutralization of special elements in XML output, aligning with CWE-91: XML Injection.

The library assumes that content placed into CDATASection nodes can be emitted verbatim, without considering that untrusted input might contain the CDATA terminator sequence ]]>.

During serialization, XMLSerializer writes CDATA content directly, so a malicious payload with ]]> closes the CDATA early and injects additional tags, attributes, or entities.

Conceptually, the bug is an output encoding/escaping failure: data and XML control characters share the same channel, and the boundary between data (inside CDATA) and markup is not enforced when user-controlled text can contain structural tokens.

Potential impact

  • Injection of arbitrary XML elements or attributes into serialized documents.
  • Manipulation of downstream XML-based business logic (e.g., changing operation types, flags, or configuration-like values).
  • Circumvention of application-level validation that assumes certain XML regions are text-only.
  • Data integrity issues where stored or forwarded XML no longer matches the original application intent.
  • Potential chaining into other XML-related issues (e.g., logic flaws, authorization bypasses) depending on how the injected XML is consumed.

General mitigation guidance

Effective mitigation focuses on enforcing a strong separation between untrusted data and XML structure, especially around CDATA sections:

  • Treat all input destined for CDATASection nodes as untrusted and ensure it cannot contain raw CDATA terminators; either sanitize or reject such sequences.
  • Prefer safe serialization patterns that automatically escape or split CDATA content when structural tokens appear, rather than writing node values verbatim.
  • Centralize XML construction in a small, well-reviewed layer where rules for handling untrusted data (encoding, escaping, or schema enforcement) are consistently applied.
  • Where possible, restrict the XML surface by using strict schemas (XSD, Relax NG) and validating serialized documents against them before further processing.
  • Apply least-privilege principles around systems that consume serialized XML so that XML injection cannot directly lead to high-impact state changes without additional checks.

How teams detect issues like this

Detection typically involves combining code-level analysis with behavioral checks:

  • Static analysis and code review:
  • Search for uses of xmldom or @xmldom/xmldom where CDATASection nodes are created from variables derived from user input or external data sources.
  • Flag patterns that directly accept untrusted strings into CDATASection.nodeValue or equivalent without sanitization.
  • Review serialization call sites (e.g., new XMLSerializer().serializeToString(doc)) that subsequently feed XML into security-sensitive workflows (e.g., signing, policy enforcement, or cross-system messages).
  • Policy and tooling:
  • Enforce secure coding guidelines for XML handling, including mandatory escaping/sanitization for data inserted into CDATA.
  • Integrate automated code review tools or linters with custom rules to identify untrusted-to-CDATA flows and missing checks.
  • Runtime/behavioral checks:
  • Log and monitor serialized XML documents in testing or staging environments, scanning for unexpected structural changes originating from data fields that should be text-only.

Sources

SourceLink
github.comgithub.com/xmldom/xmldom/commit/2b852e836ab86dbbd6cbaf0537f584dd0b5ac184
github.comgithub.com/xmldom/xmldom/releases/tag/0.8.12
github.comgithub.com/xmldom/xmldom/releases/tag/0.9.9
github.comgithub.com/xmldom/xmldom/security/advisories/GHSA-wh4c-j3r5-mjhp
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-34601
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2454595
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-34601.json

Frequently asked

questions

It can be, if a remote party can supply or influence data that your application inserts into CDATASection nodes and then serializes. In such scenarios, a remote attacker may inject XML structure into the resulting documents.

The attacker needs control over the content that becomes part of a CDATASection, which can occur through typical user inputs, API parameters, or external data feeds that the application embeds into XML before serialization.

Ensure that any data placed into CDATASection nodes is either validated to disallow the ]]> sequence or processed by a serializer that automatically escapes or splits CDATA content containing terminators. The general pattern is to never emit untrusted data as raw XML without robust escaping or structure-aware handling.

Establish a standard XML-handling layer that always encodes or validates untrusted data before embedding it into XML, mandate code review around XML serializer usage, and use automated analysis or linting rules to flag direct insertion of untrusted input into XML structures (including CDATA) without neutralization.

Find out what's already
exploitable in your codebase.