Headline
CVE-2022-36100: XWIKI-19747: Escape tag names · xwiki/xwiki-platform@6048680
XWiki Platform Applications Tag and XWiki Platform Tag UI are tag applications for XWiki, a generic wiki platform. Starting with version 1.7 in XWiki Platform Applications Tag and prior to 13.10.6 and 14.4 in XWiki Platform Tag UI, the tags document Main.Tags
in XWiki didn’t sanitize user inputs properly. This allowed users with view rights on the document (default in a public wiki or for authenticated users on private wikis) to execute arbitrary Groovy, Python and Velocity code with programming rights. This also allowed bypassing all rights checks and thus both modification and disclosure of all content stored in the XWiki installation. The vulnerability could be used to impact the availability of the wiki. On XWiki versions before 13.10.4 and 14.2, this can be combined with CVE-2022-36092, meaning that no rights are required to perform the attack. The vulnerability has been patched in versions 13.10.6 and 14.4. As a workaround, the patch that fixes the issue can be manually applied to the document Main.Tags
or the updated version of that document can be imported from version 14.4 of xwiki-platform-tag-ui using the import feature in the administration UI on XWiki 10.9 and later.
@@ -51,14 +51,15 @@ $xwiki.ssx.use(‘Main.Tags’)## ## #set ($do = “$!{request.get(‘do’)}”) #set ($tag = “$!{request.get(‘tag’)}”) #set ($wikiEscapedTag = $services.rendering.escape($tag, ‘xwiki/2.1’)) #set ($urlEscapedTag = $escapetool.url($tag)) #set ($htmlEscapedTag = $escapetool.xml($tag)) ## ## Macro displayTagAppTitle. Display level1 title of this app. ## #macro (displayTagAppTitle $urlEscapedTag $htmlEscapedTag $displayButtons) (% class="xapp" %) = (% class="highlight tag" %)${tag}## = (% class="highlight tag" %)${wikiEscapedTag}## #if ($xwiki.hasAdminRights() && $displayButtons) ## [[$services.localization.render(‘xe.tag.rename.link’)>>||queryString="do=prepareRename&tag=${urlEscapedTag}" class="button rename" rel="nofollow"]] [[$services.localization.render(‘xe.tag.delete.link’)>>||queryString="do=prepareDelete&tag=${urlEscapedTag}" class="button delete" rel="nofollow"]]## #end @@ -74,14 +75,14 @@ $xwiki.ssx.use(‘Main.Tags’)## ## #displayTagAppTitle($urlEscapedTag $htmlEscapedTag true) #if (“$!{request.get(‘renamedTag’)}” != ‘’) {{info}}$services.localization.render('xe.tag.rename.success’, [“//${request.get(‘renamedTag’)}//”]){{/info}} {{info}}$services.localization.render('xe.tag.rename.success’, [“//${services.rendering.escape(${request.get(‘renamedTag’)}, ‘xwiki/2.1’)}//”]){{/info}}
#end #set ($list = $xwiki.tag.getDocumentsWithTag($tag)) {{container layoutStyle="columns"}} ((( (% class="xapp" %) === $services.localization.render('xe.tag.alldocs’, [“//${tag}//”]) === === $services.localization.render('xe.tag.alldocs’, [“//${wikiEscapedTag}//”]) ===
#if ($list.size()> 0) {{html}}#displayDocumentList($list false $blacklistedSpaces){{/html}} @@ -91,8 +92,8 @@ $xwiki.ssx.use(‘Main.Tags’)## ))) ((( (% class="xapp" %) === $services.localization.render('xe.tag.activity’, [“//${tag}//”]) === {{notifications useUserPreferences="false" displayOwnEvents="true" tags="$tag" displayRSSLink="true" /}} === $services.localization.render('xe.tag.activity’, [“//${wikiEscapedTag}//”]) === {{notifications useUserPreferences="false" displayOwnEvents="true" tags="$wikiEscapedTag" displayRSSLink="true" /}} ))) {{/container}} #elseif ($do == ‘prepareRename’) @@ -123,7 +124,7 @@ $xwiki.ssx.use(‘Main.Tags’)## #set ($urlEscapedRenameTo = $escapetool.url($renameTo)) $response.sendRedirect($doc.getURL('view’, “do=viewTag&tag=${urlEscapedRenameTo}&renamedTag=${urlEscapedTag}”)) #else {{error}}$services.localization.render('xe.tag.rename.failure’, ["//${tag}//", “//${renameTo}//”]){{/error}} {{error}}$services.localization.render('xe.tag.rename.failure’, ["//${wikiEscapedTag}//", “//${services.rendering.escape($renameTo, ‘xwiki/2.1’)}//”]){{/error}} #end #elseif ($do == ‘prepareDelete’) ## @@ -148,15 +149,15 @@ $xwiki.ssx.use(‘Main.Tags’)## #if ($success == true || $success == ‘OK’) $response.sendRedirect($doc.getURL('view’, “deletedTag=${urlEscapedTag}”)) #else {{error}}$services.localization.render('xe.tag.delete.failure’, [“//${tag}//”]){{/error}} {{error}}$services.localization.render('xe.tag.delete.failure’, [“//${wikiEscapedTag}//”]){{/error}} #end #else ## ## View all tags (Tag Cloud) ## #set ($title = ‘All Tags’) #if (“$!{request.get(‘deletedTag’)}” != ‘’) {{info}}$services.localization.render('xe.tag.delete.success’, [“//${request.get(‘deletedTag’)}//”]){{/info}} {{info}}$services.localization.render('xe.tag.delete.success’, [“//${services.rendering.escape($request.get(‘deletedTag’), ‘xwiki/2.1’)}//”]){{/info}}
#end {{tagcloud/}}
Related news
XWiki Platform is a generic wiki platform offering runtime services for applications built on top of it. When an XWiki installation is upgraded and that upgrade contains a fix for a bug in a document, just a new version of that document is added. In some cases, it's still possible to exploit the vulnerability that was fixed in the new version. The severity of this depends on the fixed vulnerability, for the purpose of this advisory take CVE-2022-36100/GHSA-2g5c-228j-p52x as example - it is easily exploitable with just view rights and critical. When XWiki is upgraded from a version before the fix for it (e.g., 14.3) to a version including the fix (e.g., 14.4), the vulnerability can still be reproduced by adding `rev=1.1` to the URL used in the reproduction steps so remote code execution is possible even after upgrading. Therefore, this affects the confidentiality, integrity and availability of the whole XWiki installation. This vulnerability also affects manually added script macros tha...
### Impact The tags document `Main.Tags` in XWiki didn't sanitize user inputs properly, allowing users with view rights on the document (default in a public wiki or for authenticated users on private wikis) to execute arbitrary Groovy, Python and Velocity code with programming rights. This allows bypassing all rights checks and thus both modification and disclosure of all content stored in the XWiki installation. Also, this could be used to impact the availability of the wiki. Some versions of XWiki XML-escaped the tag (e.g., version 3.1) but this isn't a serious limitation as string literals can be delimited by `/` in Groovy and `<` and `>` aren't necessary, e.g., to elevate privileges of the current user. On XWiki versions before 13.10.4 and 14.2, this can be combined with the [authentication bypass using the login action](https://github.com/xwiki/xwiki-platform/security/advisories/GHSA-8h89-34w2-jpfm), meaning that no rights are required to perform the attack. The following URL dem...