CAPEC-250: XML Injection

Standard Draft 攻击可能性: High

CAPEC版本: 3.9

更新日期: 2023-01-24

攻击模式描述

An attacker utilizes crafted XML user-controllable input to probe, attack, and inject data into the XML database, using techniques similar to SQL injection. The user-controllable input can allow for unauthorized viewing of data, bypassing authentication or the front-end application for direct XML database access, and possibly altering database information.

执行流程

步骤 1 Explore

[Survey the Target] Using a browser or an automated tool, an adversary records all instances of user-controllable input used to contruct XML queries

技术:
  • Use an automated tool to record all instances of user-controllable input used to contruct XML queries.
  • Use a browser to manually explore the website and analyze how the application processes inputs.
步骤 2 Experiment

[Determine the Structure of Queries] Using manual or automated means, test inputs found for XML weaknesses.

技术:
  • Use XML reserved characters or words, possibly with other input data to attempt to cause unexpected results and identify improper input validation.
步骤 3 Exploit

[Inject Content into XML Queries] Craft malicious content containing XML expressions that is not validated by the application and is executed as part of the XML queries.

技术:
  • Use the crafted input to execute unexpected queries that can disclose sensitive database information to the attacker.

前提条件

  • XML queries used to process user input and retrieve information stored in XML documents
  • User-controllable input not properly sanitized

所需技能

Low An attacker must have knowledge of XML syntax and constructs in order to successfully leverage XML Injection

所需资源

  • None: No specialized resources are required to execute this type of attack.

后果影响

影响范围: Confidentiality Access Control Authorization

技术影响: Gain Privileges

影响范围: Confidentiality

技术影响: Read Data

缓解措施

Strong input validation - All user-controllable input must be validated and filtered for illegal characters as well as content that can be interpreted in the context of an XML data or a query.

Use of custom error pages - Attackers can glean information about the nature of queries from descriptive error messages. Input validation must be coupled with customized error pages that inform about an error without disclosing information about the database or application.

示例实例

Consider an application that uses an XML database to authenticate its users. The application retrieves the user name and password from a request and forms an XPath expression to query the database. An attacker can successfully bypass authentication and login without valid credentials through XPath Injection. This can be achieved by injecting the query to the XML database with XPath syntax that causes the authentication check to fail. Improper validation of user-controllable input and use of a non-parameterized XPath expression enable the attacker to inject an XPath expression that causes authentication bypass.

分类映射

分类名称 条目ID 条目名称
WASC 23 XML Injection
关键信息

CAPEC ID: CAPEC-250

抽象级别: Standard

状态: Draft

攻击可能性: High

相关攻击模式