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

Source: https://junglewise.ai/threats/cve-2026-27942-naturalintelligence-fast-xml-parser-stack-overflow-in-xmlbuilder  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-02-26. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

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)](https://junglewise.ai/threats/technologies/fast-xml-parser). Vendors: [npm](https://junglewise.ai/threats/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

  ```sh
  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

- [https://github.com/NaturalIntelligence/fast-xml-parser/security/advisories/GHSA-fj3w-jwp8-x2g3](https://github.com/NaturalIntelligence/fast-xml-parser/security/advisories/GHSA-fj3w-jwp8-x2g3)

## Related threats

- [fast-xml-parser: Quadratic CPU consumption scanning unterminated stop-node tags](https://junglewise.ai/threats/cve-2026-126066-fast-xml-parser-allows-users-to-process-xml-from-js-object)
- [fast-xml-parser DOCTYPE reset entity expansion limits bypass](https://junglewise.ai/threats/cve-2026-73569-fast-xml-parser-doctype-reset-entity-expansion-limits-bypass)
- [NaturalIntelligence fast-xml-parser XML injection in XMLBuilder](https://junglewise.ai/threats/cve-2026-41650-naturalintelligence-fast-xml-parser-xml-injection-in-xmlbuilder)
- [fast-xml-parser entity expansion bypass via falsy zero check](https://junglewise.ai/threats/cve-2026-33349-fast-xml-parser-entity-expansion-bypass-via-falsy-zero-check)
- [fast-xml-parser numeric entity expansion bypass](https://junglewise.ai/threats/cve-2026-33036-fast-xml-parser-numeric-entity-expansion-bypass)
