The vulnerability allows remote code execution through the preview of XClass changes in the App Within Minutes (AWM) editor. This is because the PropertyClass.displayCustom method, which is responsible for rendering the custom display of XClass properties, did not correctly establish the security context for rendering.
The patch ef978315649cf83eae396021bb33603a1a5f7e42 reveals two key changes in com.xpn.xwiki.objects.classes.PropertyClass.displayCustom:
- Document Source: The
classDocument (representing the XClass definition) was previously fetched using context.getWiki().getDocument(...). This could retrieve a version from the cache or one currently being edited, which might not reflect the authoritative security attributes (like author or restricted status). The fix changes this to getObject().getOwnerDocument(), ensuring the actual, saved document is used.
- Restricted Status: The method was modified to explicitly pass the
classDocument.isRestricted() status to the renderContentInContext method (by calling a new overload of this method). Previously, this crucial security flag might not have been consistently applied, potentially allowing content that should be restricted to be rendered with higher privileges.
These flaws meant that an attacker with edit rights on an AWM application could craft malicious content for a property's custom display. When this custom display was previewed, the displayCustom method would render it using an incorrect or insufficiently secured context (e.g., wrong author, missing restricted flag). If the custom display content included executable scripts (like Velocity or Groovy, common in XWiki), these scripts could run with elevated permissions, leading to remote code execution.
The displayCustom function is identified as the vulnerable function because it was responsible for these incorrect context-setting steps before initiating the rendering process. The changes in the patch directly address these issues within this function to ensure that custom content is rendered with the correct author context and restriction status derived from the authoritative owner document.