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.2Every release on a timeline
5.x
Not affected
5.0.0 – 5.12.1
60 releases, latest
4.x
Affected
4.0.0 – 4.1.1
18 releases
Fixed
4.1.2 – 4.5.7
28 releases
3.x
Affected
3.0.0 – 3.21.1
60 releases
2.x
Affected
2.0.0 – 2.9.4
26 releases
1.x
Affected
1.0.0 – 1.1.1
3 releases
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 hackedPatches
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
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.