CVE-2023-50723: Improper Control of Generation of Code ('Code Injection') (CWE-94)
value: XWiki Platform is a generic wiki platform. Starting in 2.3 and prior to versions 14.10.15, 15.5.2, and 15.7-rc-1, anyone who can edit an arbitrary wiki page in an XWiki installation can gain programming right through several cases of missing escaping in the code for displaying sections in the administration interface. This impacts the confidentiality, integrity and availability of the whole XWiki installation. Normally, all users are allowed to edit their own user profile so this should be exploitable by all users of the XWiki instance. This has been fixed in XWiki 14.10.15, 15.5.2 and 15.7RC1. The patches can be manually applied to the `XWiki.ConfigurableClassMacros` and `XWiki.ConfigurableClass` pages.
CWE description: The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
CVSS v3 base score: 8.8
Published: 2023-12-15T19:15Z
Repository: https://github.com/xwiki/xwiki-platform
Language: XML
Files changed: xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-ui/src/main/resources/XWiki/ConfigurableClass.xml
Commit date: 2023-08-02 15:36:27 +0200
Commit message: XWIKI-21194: Improve escaping of error message in ConfigurableClass

Diff: diff --git a/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-ui/src/main/resources/XWiki/ConfigurableClass.xml b/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-ui/src/main/resources/XWiki/ConfigurableClass.xml
index 7cf43fa097386..df9c658d59f14 100644
--- a/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-ui/src/main/resources/XWiki/ConfigurableClass.xml
+++ b/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-ui/src/main/resources/XWiki/ConfigurableClass.xml
@@ -239,11 +239,16 @@
               ##
               #if(!$obj || $obj.getClass().getName().indexOf('.Object') == -1)
                 #showHeading($appName, $headingShowing)
 
                 {{error}}
-                  {{translation key="xe.admin.configurable.noObjectOfConfigurationClassFound" parameters="$objClass.getName(), $app.getFullName()"/}}
+                  #set($escapedObjClassName =
+                    $services.rendering.escape($escapetool.java($objClass.getName()), 'xwiki/2.1'))
+                  #set($translationEscapedAppName =
+                    $services.rendering.escape($escapetool.java($app.getFullName()), 'xwiki/2.1'))
+                  {{translation key="xe.admin.configurable.noObjectOfConfigurationClassFound"
+                    parameters="~"$escapedObjClassName~", ~"$translationEscapedAppName~""/}}
                 {{/error}}
 
               #else
                 ##
                 ## Merge save buttons, remove headings from subsections, and make information links into popups.

Vulnerable code:                   {{translation key="xe.admin.configurable.noObjectOfConfigurationClassFound" parameters="$objClass.getName(), $app.getFullName()"/}}
Fixed code:                   #set($escapedObjClassName =
                    $services.rendering.escape($escapetool.java($objClass.getName()), 'xwiki/2.1'))
                  #set($translationEscapedAppName =
                    $services.rendering.escape($escapetool.java($app.getFullName()), 'xwiki/2.1'))
                  {{translation key="xe.admin.configurable.noObjectOfConfigurationClassFound"
                    parameters="~"$escapedObjClassName~", ~"$translationEscapedAppName~""/}}