Packages / fast-xml-parser / Security

ModerateVulnerabilityGHSA-x3cc-x39p-42qxCVE-2021-26920CVE-2023-26920GHSA-793h-6f7r-6qvmPublished 13 Jun 2023

fast-xml-parser vulnerable to Prototype Pollution through tag or attribute name

Your version

Affected releases · fast-xml-parser

  • 4.x4.0.0 – 4.1.1Fixed in 4.1.2
  • 3.x and older1.0.0 – 3.21.1No fix, no longer updated

On 4.x, the newest line:

npm install fast-xml-parser@4.1.2
Every release on a timeline
5.x
  1. Not affected

    5.0.0 – 5.12.1

    60 releases, latest

4.x
  1. Affected

    4.0.0 – 4.1.1

    18 releases

  2. Fixed

    4.1.2 – 4.5.7

    28 releases

3.x
  1. Affected

    3.0.0 – 3.21.1

    60 releases

2.x
  1. Affected

    2.0.0 – 2.9.4

    26 releases

1.x
  1. Affected

    1.0.0 – 1.1.1

    3 releases

195 stable releases of fast-xml-parser, oldest to newest, one row per major.

What happens

Impact

As a part of this vulnerability, user was able to se code using __proto__ as a tag or attribute name.

const { XMLParser, XMLBuilder, XMLValidator} = require("fast-xml-parser");

let XMLdata = "<__proto__><polluted>hacked</polluted></__proto__>"

const parser = new XMLParser();
let jObj = parser.parse(XMLdata);

console.log(jObj.polluted) // should return hacked

Patches

The problem has been patched in v4.1.2

Workarounds

User can check for "proto" in the XML string before parsing it to the parser.

References

gist.github.com/Sudistark/a5a45bd0804d522a1392c…

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.