CWE-652: Improper Neutralization of Data within XQuery Expressions ('XQuery Injection')
The product uses external input to dynamically construct an XQuery expression used to retrieve data from an XML database, but it does not neutralize or incorrectly neutralizes that input. This allows an attacker to control the structure of the query.
View on MITREExtended 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).
Technical Details
- Structure
- Simple
Applicable To
Security Consequences
Scope
Impact
An attacker might be able to read sensitive information from the XML database.
Mitigation Strategies
Phase
Description
Use parameterized queries. This will help ensure separation between data plane and control plane.
Phase
Description
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.
Detection Methods
No detection method information available for this CWE.
Code Examples & CVEs
No examples or observed CVEs available for this CWE.
CWE Relationships
No relationship information available for this CWE.
Frequently Asked Questions
What is CWE-652: Improper Neutralization of Data within XQuery Expressions ('XQuery Injection')?+
CWE-652: Improper Neutralization of Data within XQuery Expressions ('XQuery Injection') is a Common Weakness Enumeration (CWE) entry maintained by MITRE. The product uses external input to dynamically construct an XQuery expression used to retrieve data from an XML database, but it does not neutralize or incorrectly neutralizes that input. This allows an attacker to control the structure of the query. 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).
What are the security consequences of Improper Neutralization of Data within XQuery Expressions ('XQuery Injection')?+
If exploited, CWE-652 (Improper Neutralization of Data within XQuery Expressions ('XQuery Injection')) it can compromise Confidentiality, leading to outcomes such as Read Application Data.
How do you prevent or mitigate Improper Neutralization of Data within XQuery Expressions ('XQuery Injection')?+
Recommended mitigations for CWE-652 include: 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.
Which programming languages are affected by Improper Neutralization of Data within XQuery Expressions ('XQuery Injection')?+
CWE-652 commonly affects Not Language-Specific. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.
What is the difference between a CWE and a CVE?+
A CWE (Common Weakness Enumeration) like CWE-652 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.