CWE-611 XML外部实体引用的不恰当限制(XXE)

Improper Restriction of XML External Entity Reference

结构: Simple

Abstraction: Base

状态: Draft

被利用可能性: unkown

基本描述

The software processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output.

扩展描述

XML documents optionally contain a Document Type Definition (DTD), which, among other features, enables the definition of XML entities. It is possible to define an entity by providing a substitution string in the form of a URI. The XML parser can access the contents of this URI and embed these contents back into the XML document for further processing.

By submitting an XML file that defines an external entity with a file:// URI, an attacker can cause the processing application to read the contents of a local file. For example, a URI such as "file:///c:/winnt/win.ini" designates (in Windows) the file C:\Winnt\win.ini, or file:///etc/passwd designates the password file in Unix-based systems. Using URIs with other schemes such as http://, the attacker can force the application to make outgoing requests to servers that the attacker cannot reach directly, which can be used to bypass firewall restrictions or hide the source of attacks such as port scanning.

Once the content of the URI is read, it is fed back into the application that is processing the XML. This application may echo back the data (e.g. in an error message), thereby exposing the file contents.

相关缺陷

  • cwe_Nature: ChildOf cwe_CWE_ID: 610 cwe_View_ID: 1000 cwe_Ordinal: Primary

  • cwe_Nature: ChildOf cwe_CWE_ID: 610 cwe_View_ID: 1003 cwe_Ordinal: Primary

  • cwe_Nature: PeerOf cwe_CWE_ID: 441 cwe_View_ID: 1000

适用平台

Language: {'cwe_Name': 'XML', 'cwe_Prevalence': 'Undetermined'}

Paradigm: {'cwe_Name': 'Web Based', 'cwe_Prevalence': 'Undetermined'}

常见的影响

范围 影响 注释
Confidentiality ['Read Application Data', 'Read Files or Directories'] If the attacker is able to include a crafted DTD and a default entity resolver is enabled, the attacker may be able to access arbitrary files on the system.
Integrity Bypass Protection Mechanism The DTD may include arbitrary HTTP requests that the server may execute. This could lead to other attacks leveraging the server's trust relationship with other entities.
Availability ['DoS: Resource Consumption (CPU)', 'DoS: Resource Consumption (Memory)'] The software could consume excessive CPU cycles or memory using a URI that points to a large file, or a device that always returns data such as /dev/random. Alternately, the URI could reference a file that contains many nested or recursive entity references to further slow down parsing.

可能的缓解方案

['Implementation', 'System Configuration']

策略:

Many XML parsers and validators can be configured to disable external entity expansion.

分析过的案例

标识 说明 链接
CVE-2005-1306 A browser control can allow remote attackers to determine the existence of files via Javascript containing XML script. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-1306
CVE-2012-5656 XXE during SVG image conversion https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-5656
CVE-2012-2239 XXE in PHP application allows reading the application's configuration file. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-2239
CVE-2012-3489 XXE in database server https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-3489
CVE-2012-4399 XXE in rapid web application development framework allows reading arbitrary files. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-4399
CVE-2012-3363 XXE via XML-RPC request. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-3363
CVE-2012-0037 XXE in office document product using RDF. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-0037
CVE-2011-4107 XXE in web-based administration tool for database. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-4107
CVE-2010-3322 XXE in product that performs large-scale data analysis. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-3322
CVE-2009-1699 XXE in XSL stylesheet functionality in a common library used by some web browsers. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-1699

Notes

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
WASC 43 XML External Entities
Software Fault Patterns SFP24 Tainted input to command

相关攻击模式

  • CAPEC-221

引用