XML Injection Affecting xml2js package, versions >=0.4.5


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.48% (44th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about XML Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-XML2JS-23400633
  • published3 Dec 2026
  • disclosed2 Dec 2026
  • creditZachariah Mithani, spokodev

Introduced: 2 Dec 2026

NewCVE-2026-142213  (opens in a new tab)
CWE-91  (opens in a new tab)

How to fix?

There is no fixed version for xml2js.

Overview

Affected versions of this package are vulnerable to XML Injection in the escapeCDATA function in lib/builder.js. An attacker can inject arbitrary XML elements and attributes into the generated document by supplying a value, serialized with the cdata option, that contains two or more ]]> sequences, since only the first is escaped and any later one prematurely closes the CDATA section ahead of attacker-controlled content. This requires the application to enable the non-default cdata: true builder option.

CVSS Base Scores

version 4.0
version 3.1