CAPEC-228: DTD Injection
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.
Last updated
Overview
CAPEC-228 (DTD Injection) is a detailed-level attack pattern catalogued by MITRE in the Common Attack Pattern Enumeration and Classification (CAPEC). It describes a recurring method attackers use to exploit software weaknesses.
How the attack works
The phases an attacker typically follows.
- Step 1Explore
[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 2Explore
[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 3Exploit
[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.
What the attacker needs
Prerequisites
- The target must be running an XML based application that leverages DTDs.
How to mitigate it
Defenses that reduce the risk of CAPEC-228.
- 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.
Frequently asked questions
Common questions about CAPEC-228.
- 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.
Sources
- [1]DoS Flaw in SOAP DTD Parameter (2003)
References
Attack-pattern data is sourced from the MITRE CAPEC catalog (v3.9). Weakness associations link to the corresponding CWE entries on RadicalNotion.AI.
Defend against CAPEC-228
Track the CVEs and weaknesses this technique exploits, with AI-written analysis and remediation steps.