Skip to main content

Free 30-min security demo  — We'll scan your real code and show live findings, no commitment Book Now

Offensive360
ZeroDays CVE-2024-21650
Critical CVE-2024-21650 CVSS 10.0 XWiki Platform Java

XWiki Platform RCE via User Registration Parameter Injection

CVE-2024-21650 is a critical remote code execution flaw in XWiki Platform affecting user registration. Attackers exploit unsanitized first/last name fields to execute arbitrary code on vulnerable instances.

Offensive360 Research Team
Affects: <14.10.17, <15.5.3, <15.8-RC1
Source Code

Overview

CVE-2024-21650 represents a critical remote code execution vulnerability in XWiki Platform, a popular open-source wiki engine built on Java and designed for enterprise knowledge management and collaborative application development. The vulnerability exists in the user registration functionality and allows unauthenticated attackers to execute arbitrary code by injecting malicious payloads into user profile fields during the registration process.

This vulnerability is particularly severe because it affects the default registration workflow available to guest users on most XWiki installations. The attack surface is maximally exposed since no authentication is required to trigger the vulnerability, and the exploitation mechanism is straightforward enough to be weaponized at scale. Organizations running XWiki versions prior to the patched releases (14.10.17, 15.5.3, and 15.8-RC1) face immediate and critical risk of full system compromise.

Technical Analysis

The root cause of CVE-2024-21650 lies in insufficient input validation and dangerous template evaluation within the user registration handler. XWiki’s expression language (EL) engine processes user-supplied data without proper escaping, allowing attackers to break out of string contexts and execute arbitrary code through Groovy or XWiki’s velocity template syntax.

When a user registers with a crafted “first name” or “last name” value containing expression language directives, the registration handler passes this unsanitized input directly to the template rendering engine. XWiki’s templating system interprets these directives as executable code rather than plain text, leading to remote code execution in the context of the application server.

Consider the vulnerable registration flow:

// Vulnerable code pattern (simplified representation)
public void registerUser(String firstName, String lastName, String email) {
    User newUser = new User();
    newUser.setFirstName(firstName);  // Unsanitized input
    newUser.setLastName(lastName);    // Unsanitized input
    newUser.setEmail(email);
    
    // Template rendering without escaping
    String welcomeMessage = templateEngine.render(
        "Welcome ${firstName} ${lastName}!",
        newUser
    );
    
    // This triggers code execution if firstName/lastName contain EL expressions
    emailService.sendWelcome(welcomeMessage);
}

An attacker could register with a first name like:

${ Runtime.getRuntime().exec("touch /tmp/pwned") }

Or more sophisticated payloads leveraging XWiki’s Groovy integration:

{{groovy}}Runtime.getRuntime().exec("/bin/bash -c 'malicious-command'"){{/groovy}}

The patched version introduces proper input validation and output encoding:

// Fixed code pattern
public void registerUser(String firstName, String lastName, String email) {
    // Validate and sanitize input
    String sanitizedFirstName = sanitizeInput(firstName);
    String sanitizedLastName = sanitizeInput(lastName);
    
    User newUser = new User();
    newUser.setFirstName(sanitizedFirstName);
    newUser.setLastName(sanitizedLastName);
    newUser.setEmail(email);
    
    // Use safe template rendering with auto-escaping
    String welcomeMessage = templateEngine.renderSafe(
        "Welcome ${firstName} ${lastName}!",
        newUser,
        TemplateEscapeMode.HTML
    );
    
    emailService.sendWelcome(welcomeMessage);
}

private String sanitizeInput(String input) {
    // Remove or escape dangerous characters and patterns
    return input.replaceAll("[${#]", "").trim();
}

Impact

The impact of CVE-2024-21650 cannot be overstated. A CVSS score of 10.0 reflects the severity: complete system compromise with no authentication barriers. An attacker exploiting this vulnerability gains the ability to:

  • Execute arbitrary operating system commands with the privileges of the XWiki application server process
  • Read sensitive configuration files, including database credentials and encryption keys
  • Modify or delete wiki content and user data
  • Establish persistent backdoors for continued access
  • Pivot to internal network resources and systems accessible from the XWiki server
  • Deploy malware, ransomware, or cryptominers

For organizations using XWiki to manage internal documentation, compliance records, or sensitive architectural information, this vulnerability creates an immediate threat to confidentiality, integrity, and availability. The fact that no authentication is required dramatically widens the threat actor pool from internal adversaries to any internet-connected attacker.

How to Fix It

Immediate Action (Patching):

  1. For XWiki 14.x users: Upgrade to version 14.10.17 or later

    # Update Maven dependency
    <version>14.10.17</version>
  2. For XWiki 15.0-15.4 users: Upgrade to version 15.5.3 or later

    <version>15.5.3</version>
  3. For XWiki 15.5+ users: Upgrade to version 15.8-RC1 or the stable 15.8 release when available

    <version>15.8</version>

Deployment Steps:

  • Back up your XWiki installation and database
  • Download the patched version from the official XWiki download page
  • Stop the XWiki service
  • Replace application artifacts
  • Run database migration scripts if provided
  • Restart the service and verify functionality

Mitigation (If Immediate Patching Is Impossible):

  • Disable user self-registration temporarily: Set xwiki.registration.enabled=false in xwiki.cfg
  • Restrict registration to authenticated users only
  • Implement network-level access controls to limit exposure of the registration endpoint
  • Monitor logs for suspicious registration patterns containing special characters or expression syntax

Our Take

CVE-2024-21650 exemplifies a critical vulnerability class that should serve as a wake-up call for enterprises relying on expression language (EL) processing frameworks. Template injection and code evaluation vulnerabilities represent some of the most dangerous attack vectors because they typically yield immediate, unauthenticated code execution.

The vulnerability’s existence in such a widely-deployed project indicates that even mature, open-source platforms can fall victim to insufficient input validation around templating engines. Security teams should immediately audit their XWiki deployments and apply patches without delay. Additionally, organizations should review their own applications for similar patterns: any system that processes user input through templating or expression language engines without explicit escaping is at risk.

From a development lifecycle perspective, this vulnerability should have been caught through secure code review practices specifically trained on expression language security. Offensive360 recommends that development teams implement anti-patterns detection during code review, specifically flagging any direct concatenation of user input into template contexts.

Detection with SAST

Static analysis security testing (SAST) tools can effectively detect variants of this vulnerability by identifying dangerous patterns:

CWE-94 (Improper Control of Generation of Code): SAST should flag any instance where user input is passed directly to template engines, expression language evaluators, or dynamic code execution functions without explicit sanitization.

CWE-95 (Improper Neutralization of Directives in Dynamically Evaluated Code): Detection should trigger on patterns like:

  • templateEngine.render() or evaluate() calls with unsanitized user variables
  • Direct variable interpolation in Groovy/Velocity templates
  • Missing .escape() or similar neutralization calls

Pattern Detection:

// SAST should flag this pattern:
String userInput = request.getParameter("firstName");
templateEngine.render("Hello ${firstName}", userInput);  // ❌ Vulnerable

// And recommend this fix:
String userInput = request.getParameter("firstName");
String escaped = escapeHtml(userInput);
templateEngine.render("Hello " + escaped, userInput);  // ✓ Safe

Offensive360’s SAST analysis flags expression language security issues by tracking taint flows from user input sources through to template rendering sinks, ensuring that all user-controlled data is properly neutralized before reaching dangerous functions.

References

#remote-code-execution #java #xwiki #parameter-injection #authentication-bypass

Detect this vulnerability class in your codebase

Offensive360 SAST scans your source code for CVE-2024-21650-class vulnerabilities and thousands of other patterns — across 60+ languages.