CVE-2021-32796
JSON

6.5medium

Misinterpretation of malicious XML input in xmldom

Severity
6.5medium CVSS:3.1 by GitHub_M
Exploit likelihood
1.36% (higher than 72% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-5fg8-2547-mr8q

Description

xmldom is an open source pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module. xmldom versions 0.6.0 and older do not correctly escape special characters when serializing elements removed from their ancestor. This may lead to unexpected syntactic changes during XML processing in some downstream applications. This issue has been resolved in version 0.7.0. As a workaround downstream applications can validate the input and reject the maliciously crafted documents.

Affected

Product or packageVersionsReported by
xmldom xmldom< 0.7.0CVE List
xmldom (npm)up to 0.6.0GitHub Advisory Database
@xmldom/xmldom (npm)before 0.7.0GitHub Advisory Database
xmldom_project xmldombefore 0.7.0NVD

All scores

GitHub_M6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N
GitHub6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N
NVD5.3medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
NVD5.0medium CVSS:2.0AV:N/AC:L/Au:N/C:N/I:P/A:N

Classification

What each source says

CVE List

xmldom is an open source pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module. xmldom versions 0.6.0 and older do not correctly escape special characters when serializing elements removed from their ancestor. This may lead to unexpected syntactic changes during XML processing in some downstream applications. This issue has been resolved in version 0.7.0. As a workaround downstream applications can validate the input and reject the maliciously crafted documents.

GitHub Advisory Database
Impact

xmldom versions 0.6.0 and older do not correctly escape special characters when serializing elements removed from their ancestor. This may lead to unexpected syntactic changes during XML processing in some downstream applications.

Patches

Update to one of the fixed versions of @xmldom/xmldom (>=0.7.0)

See issue #271 for the status of publishing xmldom to npm or join #270 for Q&A/discussion until it's resolved.

Workarounds

Downstream applications can validate the input and reject the maliciously crafted documents.

References

Similar to this one reported on the Go standard library:

For more information

If you have any questions or comments about this advisory:

  • Open an issue in xmldom/xmldom
  • Email us: send an email to all addresses that are shown by npm owner ls @xmldom/xmldom
NVD (es)

xmldom es un módulo DOMParser y XMLSerializer de código abierto basado en el estándar W3C (XML DOM Level 2 Core). Las versiones 0.6.0 y anteriores de xmldom no escapan correctamente los caracteres especiales al serializar elementos eliminados de su ancestro. Esto puede provocar cambios sintácticos inesperados durante el procesamiento de XML en algunas aplicaciones posteriores. Este problema se ha resuelto en la versión 0.7.0. Como solución, las aplicaciones posteriores pueden validar la entrada y rechazar los documentos maliciosos

References

Sources

SourceRecordLicence
CVE ListCVE-2021-32796 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-5fg8-2547-mr8q changed 2026-09-10CC-BY-4.0
NVDCVE-2021-32796 changed 2026-06-17Public domain