CVE-2026-27942: fast-xml-parser Stack Overflow Vulnerability with preserveOrder

fast-xml-parser Updated 27 Feb 2026

Summary

26/02/2026
Yes i
Low
2.7

CVE-2026-27942: fast-xml-parser has stack overflow in XMLBuilder with preserveOrder. Affects fast-xml-parser versions < 5.3.8. Fixed in 5.3.8. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

fast-xml-parser is a popular XML parsing library for Node.js that allows developers to convert XML data into JavaScript objects and vice versa. It is widely used due to its lightweight nature and ease of use. However, a vulnerability has been discovered in its XMLBuilder functionality when the preserveOrder option is enabled, which can lead to application crashes.

Vulnerability Detail

The vulnerability arises from the XMLBuilder's arrToStr function, which fails to validate whether the input is an array or a string. When the preserveOrder option is set to true, certain malformed inputs can cause a stack overflow, leading to application crashes. This issue can be triggered by specific input structures, such as nested arrays or objects, which the function does not handle correctly. The impact of this vulnerability is significant as it can disrupt application functionality and lead to denial of service.

How To Fix

Latest published version: 5.11.2 as of 23 Oct 2026

npm install fast-xml-parser@5.11.2

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

5.3.8

This is the first release that contains the fix.

npm install fast-xml-parser@5.3.8

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, you can set the preserveOrder option to false when using the XML builder. Alternatively, validate the input data before passing it to the builder to ensure it meets the expected structure. Example code to set preserveOrder to false:

const parser = require('fast-xml-parser');
const options = {
preserveOrder: false
};
const jsonObj = parser.parse(xmlData, options);

Conclusion

The fast-xml-parser package has a vulnerability that can lead to stack overflow and application crashes when using the XMLBuilder with the preserveOrder option enabled. It is crucial to update to the patched version or implement workarounds to ensure application stability.

See every vulnerability recorded for fast-xml-parser →

Share this vulnerability

FAQ

The CVSS score of this vulnerability is 2.7, indicating a low severity level.

You can use Vulert's playground at Vulert Scanner to check if your application is affected without requiring any signup.

If left unaddressed, this vulnerability can lead to application crashes and potential denial of service, impacting user experience.

Yes, the vulnerability can be triggered by specific input structures, such as nested arrays or objects when using the XMLBuilder with preserveOrder set to true.

It is recommended to upgrade to version 5.3.8 or later of the fast-xml-parser package to mitigate this vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for fast-xml-parser.

How To Fix

Latest published version: 5.11.2 as of 23 Oct 2026

npm install fast-xml-parser@5.11.2

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

5.3.8

This is the first release that contains the fix.

npm install fast-xml-parser@5.3.8

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback