Failure to Sanitize Data within XQuery Expressions ('XQuery Injection') |
Weakness ID: 652 (Weakness Base) | Status: Incomplete |
Description Summary
Extended Description
The net effect is that the attacker will have control over the information selected from the XML database and may use that ability to control application flow, modify logic, retrieve unauthorized data, or bypass important checks (e.g. authentication).
Scope | Effect |
---|---|
Integrity | Controlling application flow (e.g. bypassing authentication) |
Confidentiality | Information disclosure |
XQL queries are constructed dynamically using user supplied input that has not been sufficiently validated. |
Reference | Description |
---|---|
From CAPEC 84: An attacker can pass XQuery expressions embedded in otherwise standard XML documents. Like SQL injection attacks, the attacker tunnels through the application entry point to target the resource access layer. The string below is an example of an attacker accessing the accounts.xml to request the service provider send all user names back. doc(accounts.xml)//user[name='*'] The attacks that are possible through XQuery are difficult to predict, if the data is not validated prior to executing the XQL. |
Use parameterized queries. This will help ensure separation between data plane and control plane. |
Properly validate user input. Reject data where appropriate, filter where appropriate and escape where appropriate. Make sure input that will be used in XQL queries is safe in that context. |
Nature | Type | ID | Name | View(s) this relationship pertains to![]() |
---|---|---|---|---|
ChildOf | ![]() | 91 | XML Injection (aka Blind XPath Injection) | Development Concepts (primary)699 Research Concepts (primary)1000 |
This weakness is similar to other weaknesses that enable injection style attacks, such as SQL injection, command injection and LDAP injection. The main difference is that the target of attack here is the XML database. |
Submissions | ||||
---|---|---|---|---|
Submission Date | Submitter | Organization | Source | |
2008-01-30 | Evgeny Lebanidze | Cigital | External Submission | |
Modifications | ||||
Modification Date | Modifier | Organization | Source | |
2008-09-08 | CWE Content Team | MITRE | Internal | |
updated Common Consequences, Relationships | ||||
2008-10-14 | CWE Content Team | MITRE | Internal | |
updated Description, Name, Relationship Notes | ||||
2009-05-27 | CWE Content Team | MITRE | Internal | |
updated Name | ||||
2009-10-29 | CWE Content Team | MITRE | Internal | |
updated Common Consequences | ||||
Previous Entry Names | ||||
Change Date | Previous Entry Name | |||
2008-10-14 | Unsafe Treatment of XQuery Input | |||
2009-05-27 | Failure to Sanitize Data within XQuery Expressions (aka 'XQuery Injection') | |||