---
title: "CAPEC-491: Quadratic Data Expansion"
url: https://radicalnotion.ai/capec/capec-491
type: capec
description: "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."
updated: 2026-06-01
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CAPEC-491: Quadratic Data Expansion

- **Abstraction:** Detailed
- **Status:** Draft
- **CAPEC catalog version:** 3.9

## Description

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.

## Alternate terms

- XML Entity Expansion (XEE)

## Execution flow

### Step 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.

### Step 2: Exploit

\[Craft malicious payload\] The adversary crafts malicious message containing nested quadratic expansion that completely uses up available server resource.

### Step 3: Exploit

\[Send the message\] Send the malicious crafted message to the target URL.

## Prerequisites

- This type of attack requires a server that accepts serialization data which supports substitution and parses the data.

## Consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Availability | Unreliable Execution, Resource Consumption | Denial of Service |

## 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.

## Example instances

In this example the attacker defines one large entity and refers to it many times. \<?xml version="1.0"?\> \<!DOCTYPE bomb \[\<!ENTITY x "AAAAA ... \[100K of them\] ... AAAA"\>\]\> \<b\>\<c\>&x;&x; ... \[100K of them\]... &x;&x;\</c\>\</b\> This results in a relatively small message of 100KBs that will expand to a message in the GB range.

## Related weaknesses (CWE)

- [CWE-770](https://radicalnotion.ai/cwe/cwe-770): Allocation of Resources Without Limits or Throttling

## Related attack patterns

| Relationship | CAPEC | Name |
| --- | --- | --- |
| Parent | [CAPEC-230](https://radicalnotion.ai/capec/capec-230) | Serialized Data with Nested Payloads |
| Related | [CAPEC-228](https://radicalnotion.ai/capec/capec-228) | DTD Injection |

## Frequently asked questions

### What is CAPEC-491?

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.

### How does a Quadratic Data Expansion attack work?

It typically unfolds over 3 phases. It begins with: \[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.

### How do you prevent CAPEC-491?

Design: Use libraries and templates that minimize unfiltered input. Use methods that limit entity expansion and throw exceptions on attempted entity expansion.

### What weaknesses does CAPEC-491 target?

CAPEC-491 exploits one CWE weakness: CWE-770 (Allocation of Resources Without Limits or Throttling).

Primary source: [MITRE CAPEC](https://capec.mitre.org/data/definitions/491.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/capec/capec-491). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
