Headline
CVE-2023-35158: XWIKI-20352: Sanitize template URLs · xwiki/xwiki-platform@d547210
XWiki Platform is a generic wiki platform offering runtime services for applications built on top of it. Users are able to forge an URL with a payload allowing to inject Javascript in the page (XSS). It’s possible to exploit the restore template to perform a XSS, e.g. by using URL such as: > /xwiki/bin/view/XWiki/Main?xpage=restore&showBatch=true&xredirect=javascript:alert(document.domain). This vulnerability exists since XWiki 9.4-rc-1. The vulnerability has been patched in XWiki 14.10.5 and 15.1-rc-1.
Expand Up
@@ -178,9 +178,9 @@
</div>
<button class="btn btn-primary">$services.localization.render(‘core.restore.confirm.yes’)</button>
#if(“$!{request.xredirect}” != ‘’)
#set($cancelUrl = “$request.xredirect”)
#getSanitizedURLAttributeValue('a’,’href’,$request.xredirect,$doc.getURL(),$cancelUrl)
#else
#set($cancelUrl = $doc.getURL())
#set($cancelUrl = $escapetool.xml($doc.getURL()))
#end
<a class="btn btn-default" href="$!{escapetool.xml(${cancelUrl})}">$services.localization.render(‘core.restore.confirm.no’)</a>
<a class="btn btn-default" href="$cancelUrl">$services.localization.render(‘core.restore.confirm.no’)</a>
#end
Related news
### Impact Users are able to forge an URL with a payload allowing to inject Javascript in the page (XSS). It's possible to exploit the restore template to perform a XSS, e.g. by using URL such as: > /xwiki/bin/view/XWiki/Main?xpage=restore&showBatch=true&xredirect=javascript:alert(document.domain) This vulnerability exists since XWiki 9.4-rc-1. ### Patches The vulnerability has been patched in XWiki 14.10.5 and 15.1-rc-1. ### Workarounds It's possible to workaround the vulnerability by editing the template restore.vm to perform checks on it, but note that the appropriate fix involves new APIs that have been recently introduced in XWiki. See the referenced jira tickets. ### References * Vulnerability in restore template: https://jira.xwiki.org/browse/XWIKI-20352 * Introduction of the macro used for fixing this vulnerability: https://jira.xwiki.org/browse/XWIKI-20583 * Commit containing the actual fix in the template: https://github.com/xwiki/xwiki-platform/commit/d5472100...