Summary by Atlassian
Stored XSS vulnerability in Confluence
Stored XSS vulnerability in Confluence
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.
Confluence Cloud (bugbounty-test-<bugcrowd-name>.atlassian.net/wiki)
Web App
https://bugbounty-test-matt.atlassian.net/wiki/spaces/TESTER/pages/262145/Test+Page+With+XSS
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
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.
../../player.js?callback=woot1234%22==alert(document.domain)||%22
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