{"id":881,"cve":"CVE-2023-29209","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2023-29209","cwe":"CWE-94 Improper Control of Generation of Code ('Code Injection')","cwe_number":94,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/94","cvss_score":8.8,"published":"2023-04-15","owasp":"A06 Vulnerable and Outdated Components","odc":"Function","cdc":"Incorrect Functionality","category":"Input Validation and Sanitization","subcategory":"Insecure Parsing or Deserialization","scope":"Remote","impact":"Arbitrary Code Execution","summary":"XWiki Commons Macro Parameter Escaping Vulnerability","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2023-29209\/","description":"XWiki Commons are technical libraries common to several other top level XWiki projects. Any user with view rights on commonly accessible documents including the legacy notification activity macro can execute arbitrary Groovy, Python or Velocity code in XWiki leading to full access to the XWiki installation. The root cause is improper escaping of the macro parameters of the legacy notification activity macro. This macro is installed by default in XWiki. The vulnerability can be exploited via every wiki page that is editable including the user's profile, but also with just view rights using the HTMLConverter that is part of the CKEditor integration which is bundled with XWiki. The vulnerability has been patched in XWiki 13.10.11, 14.4.7 and 14.10.","solution":"Update XWiki to version 13.10.11, 14.4.7, or 14.10.","affected_component":"XWiki","fixed_by_upgrading":true,"vulnerable_code":"def execute_macro(user_input):\n    \"\"\"Vulnerable function that demonstrates the security issue.\"\"\"\n    eval(user_input)\n\nuser_input = \"<script>alert('XSS')<\/script>\"\nexecute_macro(user_input)","patched_code":"import ast\n\ndef macro_execution(user_input):\n    \"\"\"Secure function that fixes the vulnerability.\"\"\"\n    escaped_input = escape(user_input)\n    \n    execute_macro(escaped_input)\n\ndef escape(input_string):\n    \"\"\"Secure function that fixes the vulnerability.\"\"\"\n    return input_string.replace('$', '\\\\$').replace('{', '\\\\{').replace('}', '\\\\}')\n\ndef execute_macro(escaped_input):\n    \"\"\"Secure function that fixes the vulnerability.\"\"\"\n    ast.literal_eval(escaped_input)\n\nuser_input = \"<script>alert('XSS')<\/script>\"\nmacro_execution(user_input)","payload_needed":false,"payload":null,"payload_status":"none","published_fix":[],"references":null}