fast-xml-parser Entity Expansion Limit Bypass Vulnerability Leading to Denial-of-Service

Vulnerability

A denial-of-service vulnerability has been identified in fast-xml-parser versions 4.0.0-beta.3 prior to 5.5.7. The issue arises in the DocTypeReader component, where JavaScript's truthy evaluation allows developers to inadvertently disable entity processing limits. When maxEntityCount or maxEntitySize is set to 0, the parser bypasses these restrictions entirely. This flaw can be exploited by supplying XML with large entities, causing memory exhaustion and service disruption.

Impact

Exploitation of this vulnerability leads to unbounded entity expansion, causing memory exhaustion and denial-of-service conditions on the server.

Reproduction

To reproduce this vulnerability, configure the fast-xml-parser XMLParser instance with processEntities.maxEntityCount and processEntities.maxEntitySize set to 0. This configuration should block entity definitions. However, due to the way JavaScript evaluates these values, the parser will bypass the intended restrictions. Once the parser is set up, supply XML containing a DOCTYPE with large entity definitions. The parser will process the entities without error, demonstrating that the limits have been successfully bypassed.

Remediation

Users can update to fast-xml-parser versions 4.5.5 or 5.5.7, where this vulnerability has been patched. If an immediate update is not possible, as a temporary workaround, keep the processEntities option set to false.

Added: Mar 24, 2026, 8:28 PM
Updated: Mar 24, 2026, 8:28 PM

Vulnerability Rating

Custom Algorithm
spread
7.8
impact
2.5
exploitability
6.0
remediation
8.3
relevance
4.6
threat
6.4
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.