CAPECattack pattern

CAPEC-84 XQuery Injection

Very High Official page ↗
Abstraction
Detailed
Status
Draft
Likelihood of attack
High
Typical severity
Very High
CAPEC version
3.9

Description

This attack utilizes XQuery to probe and attack server systems; in a similar manner that SQL Injection allows an attacker to exploit SQL calls to RDBMS, XQuery Injection uses improperly validated data that is passed to XQuery commands to traverse and execute commands that the XQuery routines have access to. XQuery injection can be used to enumerate elements on the victim's environment, inject commands to the local host, or execute queries to remote files and data sources.

Execution flow

1. [Explore] [Survey the application for user-controllable inputs] Using a browser or an automated tool, an attacker follows all public links and actions on a web site. They record all the links, the forms, the resources accessed and all other potential entry-points for the web application. 2. [Experiment] [Determine user-controllable input susceptible to injection] Determine the user-controllable input susceptible to injection. For each user-controllable input that the attacker suspects is vulnerable to XQL injection, attempt to inject characters that have special meaning in XQL. The goal is to create an XQL query with an invalid syntax. 3. [Exploit] [Information Disclosure] The attacker crafts and injects an XQuery payload which is acted on by an XQL query leading to inappropriate disclosure of information. 4. [Exploit] [Manipulate the data in the XML database] The attacker crafts and injects an XQuery payload which is acted on by an XQL query leading to modification of application data.

Prerequisites

• The XQL must execute unvalidated data

Skills required

• [Low] Basic understanding of XQuery

Consequences

• Integrity: Modify Data • Confidentiality: Read Data • Confidentiality, Access Control, Authorization: Gain Privileges • Confidentiality, Integrity, Availability: Execute Unauthorized Commands

Mitigations

• Design: Perform input allowlist validation on all XML input • Implementation: Run xml parsing and query infrastructure with minimal privileges so that an attacker is limited in their ability to probe other system resources from XQL.

Related

Child of · CAPEC (1)

Weakness · CWE (2)

  • CWE-707 Improper Neutralization weakness
  • CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component weakness

Referenced by CWE · attack pattern (2)

  • CWE-707 Improper Neutralization weakness
  • CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component weakness