CAPEC-197 Exponential Data Expansion

CAPEC ID: 197

CAPEC-197 Metadata

Likelihood of Attack

High

Typical Severity

Medium

Overview

Summary

An adversary submits data to a target application which contains nested exponential data expansion to produce excessively large output. Many data format languages allow 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.

Prerequisites

This type of attack requires that the target must receive 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.

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 subsitituion 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 Experiment [Craft malicious payload] The adversary crafts a malicious message containing nested exponential expansion that completely uses up available server resources. See the "Example Instances" section for details on how to craft this malicious payload.
3 Exploit [Send the message] Send the malicious crafted message to the target URL.

Potential Solutions / Mitigations

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)

CWE ID Description
CWE-770 Allocation of Resources Without Limits or Throttling
CWE-776 Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion')

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.

Taxonomy Mappings

Taxonomy: WASC

Entry ID Entry Name
44 XML Entity Expansion

Stay Ahead of Attack Patterns

Understanding CAPEC patterns helps security professionals anticipate and thwart potential attacks. Leverage these insights to enhance threat modeling, strengthen your software development lifecycle, and train your security teams effectively.