Confluence Stored XSS - via Widget Connector

Disclosed by
matt
  • Engagement Atlassian
  • Disclosed date over 3 years ago
  • Points 20
  • Priority P2 Bugcrowd's VRT priority rating
  • Status Resolved This vulnerability has been accepted and fixed
Summary by Atlassian

Stored XSS vulnerability in Confluence

Summary by matt

Confluence has a “Widget Connector” macro. This connector allows you to enter various links and will automatically add the proper embed script for the site.

One of the “connectors” is for a video site named Ooyala.

We can see from the OoyalaRenderer.java file that this plugin looks for a url containing something like https://ooyala.com/?embedCode=test-code (where the embed code is enforced by a regex: ([a-zA-Z0-9]+[-|_]?[a-zA-Z0-9]+)).

Once the user enters the URL they will be prompted with the “Widget Connector Ooyala Configuration” page asking for a “Branding ID”.

This loads the velocity template com/atlassian/confluence/extra/widgetconnector/templates/ooyala.vm
In that template two hidden input boxes are rendered with the brandingId and embedCode

    <fieldset class="hidden">
        <input type="hidden" name="brandingId" value="htmlEncodedBrandingId )">
      <input type="hidden" name="embedCode" value="htmlEncodeEmbedCode )">
    </fieldset>

A widget-ooyala.js javascript file is also loaded to support this connector. It pulls the values from the hidden fields then uses the following line to load remote javascript from the ooyala server:

$.getScript("//player.ooyala.com/v3/" + brandingId,
While the embedCode was strictly enforced the brandingId could actually be anything. Because of this we can use ../ in the ID and load any javascript file on the ooya server. After a bit of digging I came across the player.js file that takes a “callback” parameter.

We can use this callback parameter to injecto our own javascript in to the confluence site resulting in the stored XSS.

A final value of ../../player.js?callback=woot1234%22==alert(document.domain)||%22 for the branding id will cause the xss.

Report details
  • Submitted

  • Target Location

    Confluence Cloud (bugbounty-test-<bugcrowd-name>.atlassian.net/wiki)
  • Target category

    Web App

  • VRT

    Cross-Site Scripting (XSS) > Stored > Privileged User to Privilege Elevation
  • Priority

    P2
  • Bug URL
    https://bugbounty-test-matt.atlassian.net/wiki/spaces/TESTER/pages/262145/Test+Page+With+XSS
  • Description

    Details:

    Improper validation in the Widget Connector can lead to a stored XSS.

    POC: https://bugbounty-test-matt.atlassian.net/wiki/spaces/TESTER/pages/262145/Test+Page+With+XSS

    Screen Shot 2020-10-05 at 3.05.06 PM.png

    Confluence has a “Widget Connector” macro. This connector allows you to enter various links and will automatically add the proper embed script for the site.

    One of the “connectors” is for a video site named Ooyala.

    We can see from the OoyalaRenderer.java file that this plugin looks for a url containing something like https://ooyala.com/?embedCode=test-code (where the embed code is enforced by a regex: ([a-zA-Z0-9]+[-|_]?[a-zA-Z0-9]+)).

    Once the user enters the URL they will be prompted with the “Widget Connector Ooyala Configuration” page asking for a “Branding ID”.

    This loads the velocity template com/atlassian/confluence/extra/widgetconnector/templates/ooyala.vm
    In that template two hidden input boxes are rendered with the brandingId and embedCode

        <fieldset class="hidden">
            <input type="hidden" name="brandingId" value="htmlEncodedBrandingId )">
          <input type="hidden" name="embedCode" value="htmlEncodeEmbedCode )">
        </fieldset>
    

    A widget-ooyala.js javascript file is also loaded to support this connector. It pulls the values from the hidden fields then uses the following line to load remote javascript from the ooyala server:

    $.getScript("//player.ooyala.com/v3/" + brandingId,
    

    While the embedCode was strictly enforced the brandingId could actually be anything. Because of this we can use ../ in the ID and load any javascript file on the ooya server. After a bit of digging I came across the player.js file that takes a “callback” parameter.

    We can use this callback parameter to injecto our own javascript in to the confluence site resulting in the stored XSS.

    A final value of ../../player.js?callback=woot1234%22==alert(document.domain)||%22 for the branding id will cause the xss.

    Steps To Reproduce

    1. Create a new page.
    2. Add a "Widget Connector".
    3. Use https://ooyala.com/?embedCode=test-code as the URL.
    4. Click the refresh icon on the preview and follow the link to enter the branding ID.
    5. Enter the following: ../../player.js?callback=woot1234%22==alert(document.domain)||%22
    6. Save and publish the page.

    Impact

    This exploit will impact both the cloud and hosted server environments. An under privileged user could use this exploit view private spaces, see confidential attachments, elevate privileges. On a hosted server environment this could allow an user to load unsafe macros or plugins leading to much more serious RCE

Activity