Packages / fast-xml-parser / Security
fast-xml-parser: Repeated DOCTYPE declarations reset entity expansion limits
Affected releases · fast-xml-parser
- 5.x5.9.3 – 5.10.0Fixed in 5.10.1
On 5.x, the newest line:
npm install fast-xml-parser@5.10.1Every release on a timeline
Not affected
1.0.0 – 5.9.2
187 releases
Affected
5.9.3 – 5.10.0
2 releases
Fixed
5.10.1 – 5.12.1
6 releases, latest
What happens
Impact
fast-xml-parser processes multiple "DOCTYPE" declarations within a single XML document. Each declaration passes its entities to @nodable/entities through addInputEntities().
addInputEntities() resets the entity expansion counters every time it is called. An attacker can therefore insert additional DOCTYPE declarations to repeatedly reset maxTotalExpansions and maxExpandedLength during one parse operation.
This allows a crafted XML document to exceed the configured entity-expansion limits and can cause excessive CPU use, event-loop blocking, memory exhaustion, and process termination.
Workarounds
Manually check if multiple DOCTYPEs are not present in input contents
Update to v5.10.1
Keep
processEntityflag off
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.