CVE-2026-27942: NaturalIntelligence fast-xml-parser stack overflow in XMLBuilder

CVE-2026-27942 · Severity: medium · CVSS 4 · Published 2026-02-26

fast-xml-parser is a popular JavaScript library for parsing and building XML documents. When the XMLBuilder feature is used with the preserveOrder option enabled, the application can crash due to a stack overflow caused by improper input validation. This causes service unavailability but does not result in data exposure or unauthorized access.

Technologies: fast-xml-parser (npm). Vendors: npm.

Quick answers

Is CVE-2026-27942 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-27942 being exploited in the wild.
How severe is CVE-2026-27942?
Medium severity, with a CVSS score of 4, published 26 February 2026.
Which products and versions are affected?
fast-xml-parser (npm) SEMVER:introduced=5.0.0,fixed=5.3.8.
Is there a fix for CVE-2026-27942?
Yes. fast-xml-parser (npm): upgrade to 5.3.8 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-27942 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-27942?
Check whether you run fast-xml-parser (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • fast-xml-parser (npm): upgrade to 5.3.8 or later
    npm install fast-xml-parser@5.3.8

Technical details

The vulnerability is a stack overflow in the arrToStr function of the XMLBuilder component when preserveOrder is set to true. The root cause is insufficient input validation: arrToStr does not properly check whether its input is an array or a string, and incorrectly treats all non-array values as text content, leading to infinite recursion. An attacker can trigger this by crafting malicious XML or JSON input with nested object structures (e.g., {'foo': [{'bar': [{'@_V': 'baz'}]}]}) and passing it to XMLBuilder with preserveOrder enabled. The exploit requires no authentication and is remotely exploitable over the network if the vulnerable library is used in a web service. The vulnerability causes application crashes (denial of service). Patches are available in versions 4.5.4 and 5.3.7 or later; users can also work around the issue by disabling preserveOrder or validating input before passing it to the builder.

Affected products

  • NaturalIntelligence fast-xml-parser 4.0.0-beta.0 through 5.3.6 (fixed in 4.5.4 and 5.3.7+)

Identifiers

  • CVE-2026-27942
  • GHSA-fj3w-jwp8-x2g3

Timeline

  • 2026-02-26: disclosed
  • 2026-02-26: patched: Fixed in versions 4.5.4 and 5.3.7+

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.