Summary
fast-xml-parser versions 4.3.6 through 5.3.3 contain a flaw in numeric entity handling where out-of-range code points (such as � or �) trigger a RangeError that is not safely handled.
Applications that parse untrusted XML using these versions may crash on malformed input, enabling denial-of-service conditions through a single crafted XML document.
Affected context
This vulnerability arises in Node.js or browser-based applications that embed fast-xml-parser (versions 4.3.6–5.3.3) to process XML documents from partially or fully untrusted sources.
It specifically affects code paths that:
- Accept XML input from external clients, files, or third-party integrations
- Allow numeric entities inside XML content
- Do not wrap XML parsing calls in robust error-handling constructs
In these contexts, a single malformed numeric entity is sufficient to terminate the parsing process and potentially crash the hosting process.
Exploit preconditions
- Attack surface: Any endpoint, job, or feature that accepts XML and uses fast-xml-parser internally (HTTP APIs, message consumers, file importers, microservices).
- Required access: Ability to supply or influence XML content (e.g., HTTP request body, uploaded files, queue messages, webhook payloads, or partner feeds).
- Trigger point: Parsing of an XML document containing out-of-range numeric entities such as
�or�. - Why exploitation is possible: The parser attempts to convert invalid numeric entity code points and throws a RangeError that is not caught or normalized, allowing the exception to bubble up and crash the application if the caller does not implement defensive error handling.
Why this happens
The core issue is insufficient validation of numeric entity values before they are converted into character code points.
When an attacker supplies a numeric entity outside the allowable Unicode range, the library attempts to process it directly, resulting in a RangeError at runtime.
Because this exception is not handled within the library, it propagates into the host application, mapping to:
- CWE-20: Improper Input Validation, as entity values are not checked for valid bounds before processing.
- CWE-248: Uncaught Exception, as the resulting error is not caught and managed, allowing it to terminate execution paths unexpectedly.
The combination of these patterns turns a malformed XML value into a reliable denial-of-service mechanism.
Potential impact
- Forced termination of the Node.js process or browser context parsing the XML
- Denial of service for APIs or microservices that rely on fast-xml-parser for request or message handling
- Disruption of scheduled jobs, ETL pipelines, or background workers processing XML feeds
- Potential cascading failures in distributed systems if critical services become unavailable
General mitigation guidance
Effective mitigation focuses on hardening input validation around entity processing and ensuring robust error containment:
- Validate or normalize XML input before parsing, rejecting documents containing invalid or unusually large numeric entity values.
- Wrap all fast-xml-parser usage in defensive try/catch (or equivalent) blocks and implement graceful failure paths instead of allowing process-wide crashes.
- Apply strict limits on input size, structure complexity, and entity usage to reduce the risk surface for malformed or malicious XML.
- Prefer secure defaults in XML handling configurations (e.g., disabling unnecessary features, limiting entity interpretation when not required).
- Design services so that the failure of a single XML parsing operation does not propagate into global process termination, using isolation patterns where practical.
How teams detect issues like this
Detection typically combines code-centric review with runtime monitoring:
- Static analysis and code review:
- Search for fast-xml-parser usage where untrusted XML is parsed without surrounding error handling.
- Flag call sites that accept raw client input or third-party feeds and pass them directly to the parser.
- Review numeric entity handling logic or configuration to ensure bounds checking or sanitization is in place.
- Runtime monitoring and logging:
- Monitor for recurring RangeError exceptions related to entity decoding or character code conversion in log streams.
- Track unexpected process exits or restarts of services that consume XML, especially correlated with suspicious or malformed input payloads.
- Policy and pipeline checks:
- Enforce secure parsing patterns via internal coding standards, including mandatory try/catch around XML parsing and validation layers for untrusted data.
- Use automated review tools or linters to detect unguarded parsing of attacker-controlled XML data.

