CWE•Base•Incomplete•9 recent CVEs
CWE-643Improper Neutralization of Data within XPath Expressions
Description
The product uses external input to dynamically construct an XPath expression used to retrieve data from an XML database, but it does not neutralize or incorrectly neutralizes that input.
Common consequences
- Access Control→Bypass Protection MechanismAn attacker can control the structure of the query, possibly causing unexpected data to be returned. This can be further used to control application flow (e.g., bypassing authentication).
- Confidentiality→Read Application DataBy modifying the XPath query, an attacker could read restricted XML content by choosing which information is selected from the XML database.
Potential mitigations
- ImplementationUse parameterized XPath queries (e.g. using XQuery). This will help ensure separation between data plane and control plane.
- ImplementationProperly validate user input. Reject data where appropriate, filter where appropriate and escape where appropriate. Make sure input that will be used in XPath queries is safe in that context.