The vulnerability lies in several public methods within the com.xpn.xwiki.api.XWiki class that are exposed through the XWiki scripting API. These methods, including various overloads of searchDocuments, searchSpacesNames, searchAttachments, and countAttachments, accept a string parameter representing an HQL WHERE clause.
Prior to the patch, these methods passed the user-provided HQL string directly to the underlying Hibernate query engine without sufficient validation. Hibernate's HQL parser allows the use of native database functions. In the case of an Oracle database, an attacker could use functions like DBMS_XMLGEN.GETXML to execute arbitrary SQL queries, as the input was concatenated into a larger HQL query. This constitutes a classic SQL injection vulnerability.
The patch addresses this by introducing a new method, checkSearchQueryAllowed, which is now called by all the vulnerable search methods. This method performs a security check. If the current user does not have programming rights, it uses the HQLStatementValidator to parse and inspect the provided HQL fragment to ensure it does not contain any blacklisted (and thus potentially malicious) keywords or constructs. If the validation fails, an exception is thrown, preventing the malicious query from being executed.
The runtime indicators of exploitation would be calls to any of the vulnerable functions listed, with a crafted HQL payload as an argument. For example, a profiler would show a call to com.xpn.xwiki.api.XWiki.searchDocuments('...malicious HQL...').