Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-20848

Velocity execution without script right through VelocityCode property



    • Unit
    • Unknown
    • N/A
    • N/A


      Steps to reproduce:

      1. Log in as a user without script right
      2. Edit your user profile (or any other document) with the class editor and add a new field of type "TextArea", named "Test" and set "Content Type" to "VelocityCode".
      3. Edit the same document with the object editor and add an object of the just created class. Set its content to $request.cookies.
      4. Edit the document with the wiki editor and use the developer tools to set the value of the selected document syntax to xwiki/1.0 (no need to have XWiki 1.0 syntax installed, just ignore the errors). Save the document.
      5. Open <xwiki-host>/xwiki/bin/get/XWiki/username?xpage=display&property=XWiki.username.Test&type=object where <xwiki-host> is the URL of your XWiki installation and username is your user's name.

      Expected result:

      $request.cookies is displayed.

      Actual result:

      Content similar to [javax.servlet.http.Cookie@2f0535e1, javax.servlet.http.Cookie@3ed6f4f6, javax.servlet.http.Cookie@6eb94904, javax.servlet.http.Cookie@4e4fbe60, javax.servlet.http.Cookie@48632075] is displayed, showing that the Velocity code has been executed. Note that while the Velocity code is executed, it is executed with the correct context author. Therefore, no privileged APIs can be accessed. However, still dangerous data might be accessed and security issues that are only exploitable with script right can be exploited.

      This issue is probably very old but I'm setting the affects version to 7.2 as in XWiki 7.2, script right was introduced and thus only since 7.2 script execution without script right can be considered a security issue.


        Issue Links



              MichaelHamann Michael Hamann
              MichaelHamann Michael Hamann
              0 Vote for this issue
              1 Start watching this issue