---
title: "CAPEC-228: DTD Injection"
url: https://radicalnotion.ai/capec/capec-228
type: capec
description: "An attacker injects malicious content into an application's DTD in an attempt to produce a negative technical impact. DTDs are used to describe how XML documents are processed. Certain malformed DTDs (for example, those with excessive entity expansion as described in CAPEC 197) can cause the XML parsers that process the DTDs to consume excessive resources resulting in resource depletion."
updated: 2026-06-01
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CAPEC-228: DTD Injection

- **Abstraction:** Detailed
- **Status:** Draft
- **Typical severity:** Medium
- **CAPEC catalog version:** 3.9

## Description

An attacker injects malicious content into an application's DTD in an attempt to produce a negative technical impact. DTDs are used to describe how XML documents are processed. Certain malformed DTDs (for example, those with excessive entity expansion as described in CAPEC 197) can cause the XML parsers that process the DTDs to consume excessive resources resulting in resource depletion.

## Execution flow

### Step 1: Explore

\[Survey the target\] Using a browser or an automated tool, an attacker records all instances of web services to process XML requests.

- Use an automated tool to record all instances of URLs to process XML requests.
- Use a browser to manually explore the website and analyze how the application processes XML requests.

### Step 2: Explore

\[Determine use of XML with DTDs\] Examine application input to identify XML input that leverage the use of one or more DTDs.

- Examine any available documentation for the application that discusses expected XML input.
- Exercise the application using XML input with and without a DTD specified. Failure without DTD likely indicates use of DTD.

### Step 3: Exploit

\[Craft and inject XML containg malicious DTD payload\]

- Inject XML expansion attack that creates a Denial of Service impact on the targeted server using its DTD.
- Inject XML External Entity (XEE) attack that can cause the disclosure of confidential information, execute abitrary code, create a Denial of Service of the targeted server, or several other malicious impacts.

## Prerequisites

- The target must be running an XML based application that leverages DTDs.

## Mitigations

- Design: Sanitize incoming DTDs to prevent excessive expansion or other actions that could result in impacts like resource depletion.
- Implementation: Disallow the inclusion of DTDs as part of incoming messages.
- Implementation: Use XML parsing tools that protect against DTD attacks.

## Related weaknesses (CWE)

- [CWE-829](https://radicalnotion.ai/cwe/cwe-829): Inclusion of Functionality from Untrusted Control Sphere

## Related attack patterns

| Relationship | CAPEC | Name |
| --- | --- | --- |
| Parent | [CAPEC-250](https://radicalnotion.ai/capec/capec-250) | XML Injection |
| Can precede | [CAPEC-197](https://radicalnotion.ai/capec/capec-197) | Exponential Data Expansion |
| Can precede | [CAPEC-491](https://radicalnotion.ai/capec/capec-491) | Quadratic Data Expansion |
| Related | [CAPEC-279](https://radicalnotion.ai/capec/capec-279) | SOAP Manipulation |

## Frequently asked questions

### What is CAPEC-228?

An attacker injects malicious content into an application's DTD in an attempt to produce a negative technical impact. DTDs are used to describe how XML documents are processed. Certain malformed DTDs (for example, those with excessive entity expansion as described in CAPEC 197) can cause the XML parsers that process the DTDs to consume excessive resources resulting in resource depletion.

### How does a DTD Injection attack work?

It typically unfolds over 3 phases. It begins with: \[Survey the target\] Using a browser or an automated tool, an attacker records all instances of web services to process XML requests.

### How do you prevent CAPEC-228?

Design: Sanitize incoming DTDs to prevent excessive expansion or other actions that could result in impacts like resource depletion.

### What weaknesses does CAPEC-228 target?

CAPEC-228 exploits one CWE weakness: CWE-829 (Inclusion of Functionality from Untrusted Control Sphere).

### How severe is CAPEC-228?

MITRE rates CAPEC-228 as Medium severity.

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

---

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