VYPR
Critical severityNVD Advisory· Published Jul 24, 2025· Updated Jul 25, 2025

XWiki Platform vulnerable to SQL injection through getdeleteddocuments.vm template sort parameter

CVE-2025-32429

Description

XWiki Platform is a generic wiki platform offering runtime services for applications built on top of it. In versions 9.4-rc-1 through 16.10.5 and 17.0.0-rc-1 through 17.2.2, it's possible for anyone to inject SQL using the parameter sort of the getdeleteddocuments.vm. It's injected as is as an ORDER BY value. This is fixed in versions 16.10.6 and 17.3.0-rc-1.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
org.xwiki.platform:xwiki-platform-distribution-warMaven
>= 9.4-rc-1, < 16.10.616.10.6
org.xwiki.platform:xwiki-platform-distribution-warMaven
>= 17.0.0-rc-1, < 17.3.0-rc-117.3.0-rc-1

Affected products

1

Patches

2
f502b5d5fd36

XWIKI-23093: Improve deleted documents query

https://github.com/xwiki/xwiki-platformThomas MortagneApr 11, 2025via ghsa
2 files changed · +2 2
  • xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/query/hql/internal/DefaultHQLStatementValidator.java+1 1 modified
    @@ -117,7 +117,7 @@ public void checkOrderBySafe(List<String> allowedPrefixes, String orderByValue)
                 }
     
                 if (!valid) {
    -                throw new QueryException("Usafe ORDER BY value [" + orderByValue + "].", null);
    +                throw new QueryException("Unsafe ORDER BY value [" + orderByValue + "].", null);
                 }
             }
         }
    
  • xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/getdeleteddocuments.vm+1 1 modified
    @@ -49,7 +49,6 @@ $response.setContentType("application/json")
     #set ($order = "$!request.sort")
     #set ($orderQueryPart = '')
     #if ($order != '')
    -  #set($discard = $services.query.hql.checkOrderBySafe(['ddoc.'], $order))
       #set ($orderDirection = "$!{request.get('dir').toLowerCase()}")
       #if ("$!orderDirection" != '' && "$!orderDirection" != 'asc')
         #set($orderDirection = 'desc')
    @@ -59,6 +58,7 @@ $response.setContentType("application/json")
         ## So we filter on the document full name instead, which is the expected behavior.
         #set ($order = 'ddoc.fullName')
       #end
    +  #set($discard = $services.query.hql.checkOrderBySafe(['ddoc.'], $order))
       ## Weird things happen if we use "ORDER BY" (upper case), at least on HSQLDB. Other DBs may behave differently
       #set ($orderQueryPart = "order by ${order} ${orderDirection}")
     #end
    
dfd0744e9c18

XWIKI-23093: Improve deleted documents query

https://github.com/xwiki/xwiki-platformThomas MortagneApr 11, 2025via ghsa
2 files changed · +2 2
  • xwiki-platform-core/xwiki-platform-oldcore/src/main/java/org/xwiki/query/hql/internal/DefaultHQLStatementValidator.java+1 1 modified
    @@ -117,7 +117,7 @@ public void checkOrderBySafe(List<String> allowedPrefixes, String orderByValue)
                 }
     
                 if (!valid) {
    -                throw new QueryException("Usafe ORDER BY value [" + orderByValue + "].", null);
    +                throw new QueryException("Unsafe ORDER BY value [" + orderByValue + "].", null);
                 }
             }
         }
    
  • xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/getdeleteddocuments.vm+1 1 modified
    @@ -49,7 +49,6 @@ $response.setContentType("application/json")
     #set ($order = "$!request.sort")
     #set ($orderQueryPart = '')
     #if ($order != '')
    -  #set($discard = $services.query.hql.checkOrderBySafe(['ddoc.'], $order))
       #set ($orderDirection = "$!{request.get('dir').toLowerCase()}")
       #if ("$!orderDirection" != '' && "$!orderDirection" != 'asc')
         #set($orderDirection = 'desc')
    @@ -59,6 +58,7 @@ $response.setContentType("application/json")
         ## So we filter on the document full name instead, which is the expected behavior.
         #set ($order = 'ddoc.fullName')
       #end
    +  #set($discard = $services.query.hql.checkOrderBySafe(['ddoc.'], $order))
       ## Weird things happen if we use "ORDER BY" (upper case), at least on HSQLDB. Other DBs may behave differently
       #set ($orderQueryPart = "order by ${order} ${orderDirection}")
     #end
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

6

News mentions

0

No linked articles in our index yet.