XEE (XML Entity Expansion) |
Attack Pattern ID: 197 (Standard Attack Pattern Completeness: Stub) | Typical Severity: Medium | Status: Draft |
Summary
An attacker submits an XML document to a target application where the XML document uses nested entity expansion to produce an excessively large output XML. XML allows the definition of macro-like structures that can be used to simplify the creation of complex structures. However, this capability can be abused to create excessive demands on a processor's CPU and memory. A small number of nested expansions can result in an exponential growth in demands on memory. For example, consider:
Each entity increases the number entities by a factor of 10. If the above progression were continued to 'z' and 'z' was a simple 10-byte string, the total memory requirement of 'a' in the resulting document would be 10^26 bytes (one-hundred septillion bytes) - well beyond the capabilities of modern computers. Depending on the robustness of the target machine, this can lead to resource depletion, application crash, or even the execution of arbitrary code through a buffer overflow.
This attack is also sometimes referred to as an XML Entity Explosion attack.
The target must XML input but either fail to provide an upper limit for entity expansion or provide a limit that is so large that it does not preclude significant resource consumption.
Design: Use libraries and templates that minimize unfiltered input. Use methods that limit entity expansion and throw exceptions on attempted entity expansion.
Implementation: Normalize, filter and white list and parse with methods and routines that will detect entity expansion from untrusted sources.
CWE-ID | Weakness Name | Weakness Relationship Type |
---|---|---|
770 | Allocation of Resources Without Limits or Throttling | Targeted |
Nature | Type | ID | Name | Description | View(s) this relationship pertains to |
---|---|---|---|---|---|
ChildOf | Attack Pattern | 82 | Violating Implicit Assumptions Regarding XML Content (aka XML Denial of Service (XDoS)) | Mechanism of Attack (primary)1000 | |
ChildOf | Category | 377 | WASC Threat Classification 2.0 - WASC-44 - XML Entity Expansion | WASC Threat Classification 2.0333 | |
ParentOf | Attack Pattern | 228 | Resource Depletion through DTD Injection in a SOAP Message | Mechanism of Attack1000 |