Name |
Quadratic Data Expansion |
|
Likelyhood of attack |
Typical severity |
Medium |
High |
|
Summary |
An adversary exploits macro-like substitution to cause a denial of service situation due to excessive memory being allocated to fully expand the data. The result of this denial of service could cause the application to freeze or crash. This involves defining a very large entity and using it multiple times in a single entity substitution. CAPEC-197 is a similar attack pattern, but it is easier to discover and defend against. This attack pattern does not perform multi-level substitution and therefore does not obviously appear to consume extensive resources. |
Prerequisites |
This type of attack requires a server that accepts serialization data which supports substitution and parses the data. |
Execution Flow |
Step |
Phase |
Description |
Techniques |
1 |
Explore |
[Survey the target] An adversary determines the input data stream that is being processed by a data parser that supports using substituion on the victim's side. |
- Use an automated tool to record all instances of URLs to process requests.
- Use a browser to manually explore the website and analyze how the application processes requests.
|
2 |
Exploit |
[Craft malicious payload] The adversary crafts malicious message containing nested quadratic expansion that completely uses up available server resource. |
|
3 |
Exploit |
[Send the message] Send the malicious crafted message to the target URL. |
|
|
Solutions | Design: Use libraries and templates that minimize unfiltered input. Use methods that limit entity expansion and throw exceptions on attempted entity expansion. Implementation: For XML based data - disable altogether the use of inline DTD schemas when parsing XML objects. If a DTD must be used, normalize, filter and use an allowlist and parse with methods and routines that will detect entity expansion from untrusted sources. |
Related Weaknesses |
CWE ID
|
Description
|
CWE-770 |
Allocation of Resources Without Limits or Throttling |
|
Related CAPECS |
CAPEC ID
|
Description
|
CAPEC-230 |
Applications often need to transform data in and out of a data format (e.g., XML and YAML) by using a parser. It may be possible for an adversary to inject data that may have an adverse effect on the parser when it is being processed. Many data format languages allow the definition of macro-like structures that can be used to simplify the creation of complex structures. By nesting these structures, causing the data to be repeatedly substituted, an adversary can cause the parser to consume more resources while processing, causing excessive memory consumption and CPU utilization. |
|