CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion')

Base Draft Simple

CWE版本: 4.18

更新日期: 2025-09-09

弱点描述

The product uses XML documents and allows their structure to be defined with a Document Type Definition (DTD), but it does not properly control the number of recursive definitions of entities.

扩展描述

If the DTD contains a large number of nested or recursive entities, this can lead to explosive growth of data when parsed, causing a denial of service.

常见后果

影响范围: Availability

技术影响: DoS: Resource Consumption (Other)

说明: If parsed, recursive entity references allow the attacker to expand data exponentially, quickly consuming all system resources.

潜在缓解措施

阶段: Operation

描述: If possible, prohibit the use of DTDs or use an XML parser that limits the expansion of recursive DTD entities.

阶段: Implementation

描述: Before parsing XML files with associated DTDs, scan for recursive entity declarations and do not continue parsing potentially explosive content.

检测方法

方法: Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

有效性: High

观察示例

参考: CVE-2008-3281

XEE in XML-parsing library.

参考: CVE-2011-3288

XML bomb / XEE in enterprise communication product.

参考: CVE-2011-1755

"Billion laughs" attack in XMPP server daemon.

参考: CVE-2009-1955

XML bomb in web server module

参考: CVE-2003-1564

Parsing library allows XML bomb

引入模式

阶段 说明
Implementation -
Operation -

适用平台

编程语言
XML (Undetermined)

分类映射

分类名称 条目ID 条目名称 映射适配度
WASC 44 XML Entity Expansion -
关键信息

CWE ID: CWE-776

抽象级别: Base

结构: Simple

状态: Draft

利用可能性: Medium

相关弱点
相关攻击模式
CAPEC-197