CWEweakness

CWE-652 Improper Neutralization of Data within XQuery Expressions

High Official page ↗
Alternate terms
XQuery Injection
Abstraction
Base
Structure
Simple
Status
Incomplete
Likelihood of exploit
High
Languages
Not Language-Specific
CWE version
5.0

Description

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.

Common consequences

• Confidentiality: Read Application Data — An attacker could modify the structure of the query to control what information is selected by the XML database, then use that ability to control application flow, modify logic, retrieve unauthorized data, or bypass important checks (e.g. authentication).

Potential mitigations

• [Implementation] Use parameterized queries. This will help ensure separation between data plane and control plane. • [Implementation] 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

• Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Related

Child of · CWE (2)

  • CWE-91 XML Injection weakness
  • CWE-943 Improper Neutralization of Special Elements in Data Query Logic weakness

Referenced by CVE · weakness (2)

  • CVE-2023-28676 A cross-site request forgery (CSRF) vulnerability in Jenkins Convert To Pipeline Plugin 1.0 and earlier allows attackers to create a… vulnerability
  • CVE-2023-25015 Clockwork Web before 0.1.2, when Rails before 5.2 is used, allows CSRF. vulnerability

Referenced by CWE · has member (1)

  • CWE-1340 CISQ Data Protection Measures view

Referenced by OWASP · mapped cwe (1)