{"@ID": "776", "@Name": "Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion')", "@Abstraction": "Base", "@Structure": "Simple", "@Status": "Draft", "Description": "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.", "Extended_Description": "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.", "Related_Weaknesses": {"Related_Weakness": [{"@Nature": "ChildOf", "@CWE_ID": "674", "@View_ID": "1000", "@Ordinal": "Primary"}, {"@Nature": "ChildOf", "@CWE_ID": "674", "@View_ID": "1003", "@Ordinal": "Primary"}, {"@Nature": "ChildOf", "@CWE_ID": "405", "@View_ID": "1000"}]}, "Weakness_Ordinalities": {"Weakness_Ordinality": {"Ordinality": "Primary"}}, "Applicable_Platforms": {"Language": [{"@Class": "Not Language-Specific", "@Prevalence": "Undetermined"}, {"@Name": "XML", "@Prevalence": "Undetermined"}], "Technology": {"@Class": "Not Technology-Specific", "@Prevalence": "Undetermined"}}, "Alternate_Terms": {"Alternate_Term": [{"Term": "XEE", "Description": "XEE is the acronym commonly used for XML Entity Expansion."}, {"Term": "Billion Laughs Attack"}, {"Term": "XML Bomb", "Description": "While the \"XML Bomb\" term was used in the early years of knowledge of this issue, the XEE term seems to be more commonly used."}]}, "Modes_Of_Introduction": {"Introduction": [{"Phase": "Implementation"}, {"Phase": "Operation"}]}, "Likelihood_Of_Exploit": "Medium", "Common_Consequences": {"Consequence": {"Scope": "Availability", "Impact": "DoS: Resource Consumption (Other)", "Note": "If parsed, recursive entity references allow the attacker to expand data exponentially, quickly consuming all system resources."}}, "Detection_Methods": {"Detection_Method": {"@Detection_Method_ID": "DM-14", "Method": "Automated Static Analysis", "Description": "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.)", "Effectiveness": "High"}}, "Potential_Mitigations": {"Mitigation": [{"Phase": "Operation", "Description": "If possible, prohibit the use of DTDs or use an XML parser that limits the expansion of recursive DTD entities."}, {"Phase": "Implementation", "Description": "Before parsing XML files with associated DTDs, scan for recursive entity declarations and do not continue parsing potentially explosive content."}]}, "Demonstrative_Examples": {"Demonstrative_Example": {"@Demonstrative_Example_ID": "DX-53", "Intro_Text": "The DTD and the very brief XML below illustrate what is meant by an XML bomb. The ZERO entity contains one character, the letter A. The choice of entity name ZERO is being used to indicate length equivalent to that exponent on two, that is, the length of ZERO is 2^0. Similarly, ONE refers to ZERO twice, therefore the XML parser will expand ONE to a length of 2, or 2^1. Ultimately, we reach entity THIRTYTWO, which will expand to 2^32 characters in length, or 4 GB, probably consuming far more data than expected.", "Example_Code": {"@Nature": "Attack", "@Language": "XML", "xhtml:div": {"xhtml:br": [null, null, null, null, null, null, null, null], "#text": "<?xml version=\"1.0\"?><!DOCTYPE MaliciousDTD [<!ENTITY ZERO \"A\"><!ENTITY ONE \"&ZERO;&ZERO;\"><!ENTITY TWO \"&ONE;&ONE;\">...<!ENTITY THIRTYTWO \"&THIRTYONE;&THIRTYONE;\">]><data>&THIRTYTWO;</data>"}}}}, "Observed_Examples": {"Observed_Example": [{"Reference": "CVE-2008-3281", "Description": "XEE in XML-parsing library.", "Link": "https://www.cve.org/CVERecord?id=CVE-2008-3281"}, {"Reference": "CVE-2011-3288", "Description": "XML bomb / XEE in enterprise communication product.", "Link": "https://www.cve.org/CVERecord?id=CVE-2011-3288"}, {"Reference": "CVE-2011-1755", "Description": "\"Billion laughs\" attack in XMPP server daemon.", "Link": "https://www.cve.org/CVERecord?id=CVE-2011-1755"}, {"Reference": "CVE-2009-1955", "Description": "XML bomb in web server module", "Link": "https://www.cve.org/CVERecord?id=CVE-2009-1955"}, {"Reference": "CVE-2003-1564", "Description": "Parsing library allows XML bomb", "Link": "https://www.cve.org/CVERecord?id=CVE-2003-1564"}]}, "Taxonomy_Mappings": {"Taxonomy_Mapping": {"@Taxonomy_Name": "WASC", "Entry_ID": "44", "Entry_Name": "XML Entity Expansion"}}, "Related_Attack_Patterns": {"Related_Attack_Pattern": {"@CAPEC_ID": "197"}}, "References": {"Reference": [{"@External_Reference_ID": "REF-676"}, {"@External_Reference_ID": "REF-677"}, {"@External_Reference_ID": "REF-678"}, {"@External_Reference_ID": "REF-679"}, {"@External_Reference_ID": "REF-680"}, {"@External_Reference_ID": "REF-500"}, {"@External_Reference_ID": "REF-682"}]}, "Mapping_Notes": {"Usage": "Allowed", "Rationale": "This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.", "Comments": "Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.", "Reasons": {"Reason": {"@Type": "Acceptable-Use"}}}, "Content_History": {"Submission": {"Submission_Name": "CWE Content Team", "Submission_Organization": "MITRE", "Submission_Date": "2009-06-30", "Submission_Version": "1.5", "Submission_ReleaseDate": "2009-07-27"}, "Modification": [{"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2010-02-16", "Modification_Version": "1.8", "Modification_ReleaseDate": "2010-02-16", "Modification_Comment": "updated Taxonomy_Mappings"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2010-12-13", "Modification_Version": "1.11", "Modification_ReleaseDate": "2010-12-13", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2011-06-01", "Modification_Version": "1.13", "Modification_ReleaseDate": "2011-06-01", "Modification_Comment": "updated Common_Consequences"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2012-05-11", "Modification_Version": "2.2", "Modification_ReleaseDate": "2012-05-15", "Modification_Comment": "updated Demonstrative_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2013-02-21", "Modification_Version": "2.4", "Modification_ReleaseDate": "2013-02-21", "Modification_Comment": "updated Alternate_Terms, Applicable_Platforms, Description, Name, Observed_Examples, References, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2017-11-08", "Modification_Version": "3.0", "Modification_ReleaseDate": "2017-11-08", "Modification_Comment": "updated Likelihood_of_Exploit, References"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2018-03-27", "Modification_Version": "3.1", "Modification_ReleaseDate": "2018-03-27", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2019-06-20", "Modification_Version": "3.3", "Modification_ReleaseDate": "2019-06-20", "Modification_Comment": "updated Relationships, Type"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2020-02-24", "Modification_Version": "4.0", "Modification_ReleaseDate": "2020-02-24", "Modification_Comment": "updated Applicable_Platforms, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2021-10-28", "Modification_Version": "4.6", "Modification_ReleaseDate": "2021-10-28", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2022-04-28", "Modification_Version": "4.7", "Modification_ReleaseDate": "2022-04-28", "Modification_Comment": "updated Related_Attack_Patterns"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-01-31", "Modification_Version": "4.10", "Modification_ReleaseDate": "2023-01-31", "Modification_Comment": "updated Description"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-04-27", "Modification_Version": "4.11", "Modification_ReleaseDate": "2023-04-27", "Modification_Comment": "updated Detection_Factors, References, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-06-29", "Modification_Version": "4.12", "Modification_ReleaseDate": "2023-06-29", "Modification_Comment": "updated Mapping_Notes"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2025-12-11", "Modification_Version": "4.19", "Modification_ReleaseDate": "2025-12-11", "Modification_Comment": "updated Applicable_Platforms, Relationships, Weakness_Ordinalities"}], "Previous_Entry_Name": {"@Date": "2013-02-21", "#text": "Unrestricted Recursive Entity References in DTDs ('XML Bomb')"}}}
