Confluence Stored XSS - via Widget Connector
The Widget Connector macro's Ooyala connector failed to validate the branding ID, allowing path traversal to load a remote script with a callback parameter that injected JavaScript. An attacker could store XSS in a Confluence page, potentially viewing private spaces, confidential attachments, or elevating privileges.
- Accepted in 25 hours
- Fixed in 51 days
- Disclosed after 2.8 years
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
05 Oct 2020 22:37:53 UTC
-
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
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)||%22for the branding id will cause the xss.Steps To Reproduce
- Create a new page.
- Add a "Widget Connector".
- Use https://ooyala.com/?embedCode=test-code as the URL.
- Click the refresh icon on the preview and follow the link to enter the branding ID.
- Enter the following:
../../player.js?callback=woot1234%22==alert(document.domain)||%22 - 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
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the brandingId parameter was not validated, allowing path traversal in a script URL and abuse of a callback parameter to inject JavaScript.
Impact
An under-privileged user could view private spaces, see confidential attachments, or elevate privileges; on hosted servers it could allow loading unsafe macros or plugins leading to RCE.
What the attacker needed
A Confluence account able to create pages; victim views the crafted page
How it was found
- Create a new page.
- Add a Widget Connector.
- Use a video site URL as the embed link.
- Refresh the preview and follow the link to enter the branding ID.
- Enter a branding ID containing path traversal and a callback parameter.
- Save and publish the page.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A stored XSS bug lets an attacker save malicious JavaScript into a page so it runs for anyone who views it. Here, a Confluence feature that embeds videos trusted a user-supplied ID without checking it, so the attacker could make the page load a script from the video site that ran their own code.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.