CVE-2026-41675
XML Injection in xmldom JavaScript Library
Publication date: 2026-05-07
Last updated on: 2026-05-07
Assigner: GitHub, Inc.
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| xmldom | xmldom | 0.6.0 |
| xmldom | xmldom | to 0.8.13 (exc) |
| xmldom | xmldom | From 0.9.0 (inc) to 0.9.10 (exc) |
| xmldom | xmldom | 0.8.13 |
| xmldom | xmldom | 0.9.10 |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-91 | The product does not properly neutralize special elements that are used in XML, allowing attackers to modify the syntax, content, or commands of the XML before it is processed by an end system. |
Attack-Flow Graph
AI Powered Q&A
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
The vulnerability allows an attacker to inject arbitrary XML nodes into serialized output by exploiting unvalidated processing instruction data. This can compromise the integrity of XML data processed by applications using affected versions of the xmldom library.
Since the issue impacts data integrity by enabling XML injection, it could potentially affect compliance with standards and regulations that require data integrity and protection against unauthorized data manipulation, such as GDPR and HIPAA.
However, the vulnerability does not affect confidentiality or availability, limiting its impact to integrity concerns.
To mitigate this risk and maintain compliance, affected applications should upgrade to patched versions of xmldom (0.8.13, 0.9.10 or later) and enable the `requireWellFormed` option to enforce strict validation and prevent XML injection.
Can you explain this vulnerability to me?
The vulnerability in xmldom involves unsafe serialization of processing instruction (PI) data in XML. Specifically, attacker-controlled PI data containing the PI-closing sequence '?>' is serialized without validation or neutralization, allowing an attacker to prematurely terminate the processing instruction and inject arbitrary XML nodes into the serialized output.
This occurs because the package stores PI data verbatim and emits it directly during serialization, which can lead to XML injection. The issue affects versions prior to 0.9.10 and 0.8.13 in @xmldom/xmldom and version 0.6.0 and earlier in xmldom.
The vulnerability has been addressed by introducing a 'requireWellFormed' option that, when enabled, enforces validation and throws errors if unsafe PI data is detected.
How can this vulnerability impact me? :
This vulnerability can impact you by allowing an attacker to inject arbitrary XML nodes into the serialized XML output, compromising the integrity of the XML data.
Such XML injection can lead to unexpected behavior in applications that rely on the XML data, potentially causing logic errors, data corruption, or security bypasses.
The CVSS score of 8.7 (High) reflects the severity of the integrity impact, although confidentiality and availability are not affected.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability involves unsafe serialization of processing instruction (PI) data containing the sequence '?>' in the xmldom library. Detection involves identifying usage of vulnerable xmldom versions (prior to 0.8.13 and between 0.9.0 to 0.9.9) and monitoring XML serialization processes for unvalidated PI data.
Since this is a library vulnerability, direct network detection commands are not provided in the resources. However, you can detect vulnerable versions by checking your project's dependencies.
- Use npm or yarn to check installed xmldom versions: `npm ls @xmldom/xmldom` or `yarn list @xmldom/xmldom`.
- Search your codebase for usage of `XMLSerializer.serializeToString()` without the `requireWellFormed: true` option, which enables the fix.
- Audit logs or XML outputs for unexpected or malformed XML nodes that could indicate injection.
What immediate steps should I take to mitigate this vulnerability?
To mitigate this vulnerability, upgrade the xmldom package to a patched version where the issue is fixed.
- Upgrade to @xmldom/xmldom version 0.9.10 or later, or version 0.8.13 or later if using the 0.8.x branch.
- Enable the `requireWellFormed: true` option in `XMLSerializer.serializeToString()` and related serialization methods to enforce validation and prevent unsafe PI serialization.
- Review your code to ensure that processing instructions do not contain the PI-closing sequence `?>` or other injection-prone data.
These steps prevent attackers from injecting arbitrary XML nodes by terminating processing instructions early.