fast-xml-parser has stack overflow in XMLBuilder with preserveOrder
Published 26 Feb 2026 · Updated 10 Sept 2026
Affected packages
- Affected
- >=5.0.0 <5.3.8
- Fixed in
- 5.3.8
npm install fast-xml-parser@5.3.8- Affected
- >=4.0.0-beta.0 <4.5.4
- Fixed in
- 4.5.4
npm install fast-xml-parser@4.5.4Details
Impact
Application crashes with stack overflow when user use XML builder with prserveOrder:true for following or similar input
[{
'foo': [
{ 'bar': [{ '@_V': 'baz' }] }
]
}]Cause: arrToStr was not validating if the input is an array or a string and treating all non-array values as text content.
_What kind of vulnerability is it? Who is impacted?_
Patches
Yes in 5.3.8
Workarounds
Use XML builder with preserveOrder:false or check the input data before passing to builder.
References
Is GHSA-fj3w-jwp8-x2g3 in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected fast-xml-parser, and gives you the command that fixes it.
References
- Linkgithub.com/NaturalIntelligence/fast-xml-parser/security/advisories/GHSA-fj3w-jwp8-x2g3
- Advisorynvd.nist.gov/vuln/detail/CVE-2026-27942
- Linkgithub.com/NaturalIntelligence/fast-xml-parser/pull/791
- Linkgithub.com/NaturalIntelligence/fast-xml-parser/commit/c13a961910f14986295dd28484eee830fa1a0e8a
- Packagegithub.com/NaturalIntelligence/fast-xml-parser
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.