Summary
FreeSWITCH's bundled XML parser expands nested <!ENTITY> declarations without any depth or count limits, enabling a "billion laughs" style entity expansion attack.
An unauthenticated network attacker can send a crafted SIP PUBLISH request whose PIDF body triggers unbounded CPU and memory consumption during XML parsing.
Affected context
The vulnerability occurs in FreeSWITCH deployments that parse XML bodies using the bundled XML parser, particularly when handling PIDF content from SIP PUBLISH requests.
It is relevant where the server accepts and processes XML payloads from the network and feeds them to the XML parser before performing integrity checks, authentication validation, or resource limits.
Environments that expose SIP interfaces to untrusted or semi-trusted networks are most at risk, especially when the FreeSWITCH process shares resources with other critical services.
Exploit preconditions
- Attack surface: SIP interface receiving PUBLISH requests containing PIDF XML bodies.
- Required access: Network reachability to the FreeSWITCH SIP service; no prior authentication or valid credentials are required.
- Trigger point: Submission of a single SIP PUBLISH request whose PIDF body contains deeply nested or recursively defined XML entities.
- Why exploitation is possible: The XML parser recursively expands internal entities without enforcing bounds on depth or total expansions, allowing attacker-supplied XML to grow exponentially in memory and CPU usage.
Why this happens
This issue stems from unbounded expansion of nested XML entities in the bundled XML parser.
The parser accepts internal <!ENTITY> declarations and recursively expands them without limits on recursion depth, number of expansions, or overall output size.
This behavior aligns with CWE-776: Improper Restriction of Recursive Entity References in DTDs ("Billion Laughs"), where untrusted XML input can cause exponential resource consumption during parsing.
Conceptually, the parser treats attacker-controlled XML as trusted structural input, failing to impose defensive constraints or disable features that are unnecessary for typical application logic.
Potential impact
- FreeSWITCH process can consume excessive CPU, leading to degraded call handling and signaling performance.
- Memory exhaustion on the host running FreeSWITCH, potentially causing process crashes or system instability.
- Denial of service for legitimate VoIP traffic, including dropped calls and inability to establish new sessions.
- Potential cascading impact on co-located services sharing the same system resources.
General mitigation guidance
Mitigation generally centers on hardening XML parsing behavior and minimizing trust in externally supplied XML content.
Defensive patterns include:
- Disabling or strictly limiting XML entity expansion features that are not required by the application.
- Configuring the XML parser with maximum depth, node count, and overall expansion size limits.
- Treating all inbound XML from the network as untrusted, validating size and structure before parsing.
- Isolating the FreeSWITCH process with resource controls (e.g., per-process CPU and memory limits) to reduce blast radius in case of malformed input.
- Applying least-privilege principles for the telephony service and avoiding co-location with unrelated critical workloads on the same host.
How teams detect issues like this
Detection typically involves observing parser usage patterns and runtime behavior under load.
Practical strategies include:
- Static analysis or code review to identify XML parsers that allow entity declarations without explicit configuration of limits or feature restrictions.
- Reviewing configuration and initialization code for XML parsing, checking for disabled DTD/entity processing and defined resource bounds.
- Monitoring runtime metrics such as CPU spikes, memory usage, and abnormal SIP PUBLISH patterns indicating potential abuse.
- Implementing network-level anomaly detection to flag unusually large or structurally complex PIDF or other XML payloads.

