The billion laughs attack is an XML denial of service technique that uses nested entity expansion to multiply a small document into a huge processing burden. The parser repeatedly expands references until memory or CPU is exhausted. The result is service slowdown or outage rather than direct data theft.
How the attack works
A billion laughs attack abuses XML entity expansion, usually through nested references that cause a parser to expand a tiny input into an exponentially larger in-memory structure. The danger is not that the XML becomes complex, but that expansion happens during parsing, before the application can apply business logic or size checks.
Because the payload is small, it can bypass naive request-size limits and still create a heavy processing burden. The parser may repeatedly resolve entities until CPU or memory is consumed, which makes this a classic application-layer denial of service pattern rather than a data-exfiltration technique.
Why XML parsers are vulnerable
XML allows entity definitions so documents can reuse text and reference external or internal data. That feature becomes dangerous when a parser permits document type declarations and recursive expansion without strict limits. In practice, the weakness is often in parser configuration, not in XML itself.
This class of attack is especially problematic in systems that accept XML from untrusted sources, such as APIs, legacy integrations, SOAP services, document processors, and file import pipelines. If expansion is enabled by default, a single request can tie up threads, heap space, or downstream worker processes.
Defenders should treat parser defaults as security-relevant. Safe XML handling usually means disabling document type declarations where possible, turning off external entity resolution, and constraining entity expansion or other recursive constructs at the parser or runtime level.
How organisations check exposure
Exposure starts with inventory. Teams need to know which applications, libraries, middleware stacks, and data flows actually parse XML, because the vulnerable component is often not the endpoint that receives the request but the parser buried inside a service or integration layer. The XXE Guide is the most direct internal reference for understanding where XML parser weaknesses, including entity expansion abuse, tend to appear.
Internet-facing XML endpoints deserve priority because attack traffic can be delivered remotely and repeatedly. Legacy SOAP interfaces, SSO assertions, B2B gateways, and document upload features are common places to inspect. Vendor advisories and parser documentation should be checked for whether safe parsing modes are available and enabled.
Exposure review should also include load testing and configuration review, not just vulnerability scanning. A parser may be present but unreachable in practice, or reachable only through a narrow integration path, so asset context matters as much as code-level findings.
Remediation and detection
The most effective remediation is to remove the dangerous parsing behaviour, then verify that the application still functions without recursive expansion. Where XML is unavoidable, use hardened parser settings, apply resource limits, and prefer schemas or formats that do not rely on entity expansion. The Denial of Service at Application Layer Guide is a useful internal companion for understanding per-request limits, timeouts, and graceful degradation as defensive patterns.
Detection is usually indirect. Watch for sudden CPU spikes, heap exhaustion, parser exceptions, worker starvation, and sharp latency increases on endpoints that normally handle small XML payloads. If a service crashes or stalls after receiving a short request, that is a strong signal to inspect parsing controls and request logs.
After patching or reconfiguring, review logs and telemetry for signs that the attack already succeeded in causing outage or repeated retries. In most cases the main consequence is availability loss, but operational impact can cascade into queue buildup, failed integrations, and wider service degradation if the parser sits on a shared path.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP API Security Top 10 addresses the attack and risk surface, while OWASP ASVS, CIS Controls v8, NIST SP 800-53 Rev 5 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP ASVS | V1 — Encoding and Sanitization | XML parser hardening and safe input handling are core to preventing entity expansion abuse. |
| Recommendation — Disable dangerous XML entity processing and verify safe parser defaults for untrusted input. | ||
| CIS Controls v8 | CIS-8 — Audit Log Management | Availability attacks are often confirmed through parsing errors, spikes, and abnormal service events. |
| Recommendation — Centralize and review service and parser logs for repeated XML processing failures and resource spikes. | ||
| NIST SP 800-53 Rev 5 | SI-10 — Information Input Validation | The attack exploits unsafe handling of untrusted XML input and recursive entity expansion. |
| Recommendation — Validate and constrain XML inputs before parsing them with components that permit entity expansion. | ||
| OWASP API Security Top 10 | API4 Unrestricted Resource Consumption | The attack consumes CPU and memory through crafted XML that forces excessive parser work. |
| Recommendation — Apply request and processing limits to prevent XML payloads from exhausting shared resources. | ||
| NIST CSF 2.0 | PR.DS-10 — Data in Transit is Protected | XML parser exposure is often remote, so secure transport supports control of untrusted inputs in transit. |
| Recommendation — Protect XML submission paths with strong transport security while enforcing parser-side limits. | ||
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 31, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org