Responsible Disclosure of Privacy Leakage Issue
A privacy leak in Bitbucket allows an attacker to determine if a specific user visits an attacker-controlled page by exploiting a state-dependent URL for privately shared resources. The attacker can infer the victim's identity using cross-site leaks with video or audio HTML tags.
- Accepted in 7 days
- Disclosed after 2.5 years
Summary by Atlassian
Information disclosure vulnerability in Bitbucket
Summary by mzaheri
Greetings,
I am Mojtaba Zaheri, a doctoral candidate in Computer Science, affiliated with the NJIT Cybersecurity Research Center. Together with my doctoral dissertation advisor, Prof. Reza Curtmola, we are reaching out to perform responsible disclosure of a vulnerability present on the Bitbucket website. Please let us know if you have any comments regarding this disclosure. Summary:
We have identified a leaky resource attack against several high-profile resource-sharing websites, including Bitbucket, that allows an attacker to infer the unique identity of a victim that visits an attacker-controlled website. This targeted privacy attack can have a significant impact on the privacy of individuals.
Even though previous work introduced the attack using images (i.e., leaky images [1]), in this report we show that the attack works with any resource that can be privately shared with the victim and can be rendered on a webpage. In particular, we show the attack also works with other media files, such as video and audio files. Thus, we generically refer to the attack as a leaky resource attack. An attacker exploiting these vulnerabilities can identify a user of the Bitbucket website while the user visits an attacker-controlled website, using the cookie(s) set by the Bitbucket website in her browser.
The leaky image attack [1] leverages the existence of a state-dependent URL (SD-URL) on the image-sharing website, i.e. a URL for which the response is different depending on the victim’s state with respect to the image-sharing website. For example, if the user is the targeted victim, the content will be loaded, otherwise, it will not be loaded. The attacker can learn information about this response based on an XS-leak that bypasses the Same-Origin Policy which normally prevents the attacker from reading the contents of a cross-origin response. [1] describes script-based and scriptless variants of the leaky image attack. The scriptless variant relies on the object HTML tag for the XS-leak, using this tag’s if-then-else behavior to enable the attack.
We reveal a new SD-URL for resources in Bitbucket service and introduce two new HTML-only XS-Leaks. We show that a leaky resource attack can be performed using video and audio HTML tags. The previously known scriptless attack was based on the object HTML tag, but we find that it is not reliable: It does not work against all vulnerable resource-sharing services and only works in some browsers. As opposed to this, we show that attacks based on the video and audio tags are very reliable, as they work against all the vulnerable services we identified and across all browsers we tested with (Firefox, Edge, Chrome).
We describe below the threat model, the exploit vector, and the actual steps that need to be followed on your website to set up a leaky resource attack. We also explain potential fixes. Threat Model:
We consider attackers that can bring together the following necessary ingredients for a successful leaky resource attack:
The attacker and the victim are users of the same resource sharing service.
The resource sharing service allows its users to share resources privately with each other and authenticates users through cookies.
The attacker convinces the victim to visit the attack page (which is controlled by the attacker) while the victim is logged into her account with the resource sharing service (which is not controlled by the attacker).
The attacker can determine if the victim loaded the resources successfully.
The attack is effective because these requirements can be achieved in multiple ways and are within easy reach of the attacker. For requirement #1, the victim may have an account in Bitbucket; also, Bitbucket has free membership, and so the attacker can just create an account. For requirement #2, these are the de facto mechanisms for many of the resource sharing services. Requirement #3 can be achieved in multiple ways, including via phishing emails, or via a watering-hole approach. Requirement #4 is crucial for the attack and can be achieved as follows. The attack page contains a state-dependent URL (SD-URL) that points to content on the target website (i.e., Bitbucket). When a user makes a request for the SD-URL, the response is different depending on the user's state with respect to the Bitbucket website. For example, if the user is the targeted victim, the content will be loaded, otherwise, it will not be loaded. The attacker can learn information about this response based on an XS-leak that bypasses the Same-Origin Policy which normally prevents the attacker from reading the contents of a cross-origin response. Attacks:
The new SD-URL we reveal can be exploited by a script-based XL-leak, but here we focus on scriptless XS-leaks, as privacy-aware users may disable scripts or use protection mechanisms that prevent script-based XS-leaks.
The pattern of the new SD-URL found is:
https://bitbucket.org/{projectName}/{repoName}/raw/{commitId}/{fileName}
This SD-URL is valid until the resource is unshared or deleted.
Exploiting this SD-URL based on object tag HTML-only XS-Leak from [1]:
<object data ="https://bitbucket.org/{projectName}/{repoName}/raw/{commitId}/{fileName}" type ="image/png"> <object data ="Fallback-URL" type ="image/png"></object> </object>Communication method using the object HTML tag: If the outer object element (SD-URL) fails to load, then the fallback is to load the inner object element (Fallback-URL, controlled by the attacker). This fallback-based mechanism can be used to simulate an if-then-else control flow instruction in pure HTML. The attack does not work with browsers we tested (Firefox, Chrome, and Edge).
Here we describe the video and audio HTML tags as new XS-leaks that are reliable across all browsers we tested (Chrome/Edge before version 80.0, and Firefox 83.0).
<video width="320" height="240" controls autoplay muted> <source src="https://bitbucket.org/{projectName}/{repoName}/raw/{commitId}/{fileName}" type ="video/webm"> <source src="Fallback-URL" type ="video/webm"> </video>Communication Method using video HTML tag: If the first source (SD-URL) cannot be loaded, then the fallback is to load the second source (Fallback-URL, controlled by the attacker).
<audio width="320" height="240" controls autoplay> <source src="https://bitbucket.org/{projectName}/{repoName}/raw/{commitId}/{fileName}" type ="audio/ogg"> <source src="Fallback-URL" type ="audio/ogg"> </audio>Communication Method using audio HTML tag: If the first source (SD-URL) cannot be loaded, then the fallback is to load the second source (Fallback-URL, controlled by the attacker).
Normally, the source elements are used by website authors to specify multiple alternative media resources for media elements. However, these alternatives can be used to trigger a fallback behavior that mimics an if-then-else control flow. Both resources used in these tests have the type webm and ogg for video and audio tags respectively, but other video and audio file types can be used as well. By checking the HTTP Request Headers, the attacker can make sure whether the specific file type is supported by the browser, and so prepare an appropriate webpage.
It is worth mentioning that the reason why XS-leaks based on video and audio tags were not successful in some services when using Chrome/Edge browsers versions 80.0 and above is that different browsers behave inconsistently when the SameSite attribute is not set at all. Chromium-based browsers versions 80 and above treat cookies as if a lax SameSite attribute is set, whereas Firefox (tested up to version 83) treats them as if SameSite is set to none. Steps to Reproduce:
The attacker first shares privately a resource with the target victim using a sharing service. The attacker then embeds a link to the privately shared resource on a webpage she controls. When a visitor loads that webpage, the resource will be successfully retrieved only if the visitor is the targeted victim, since only the victim is allowed to retrieve the resource (assuming the victim's browser is logged into the sharing service). By observing the success of loading the resource through an XS-leak, the attacker will know if the intended victim has visited the attacker's website.
- Upload and share privately the resource with the victim in Bitbucket.
- Open the resource in the browser to get the SD-URL.
- Embed the SD-URL in an attacker-controlled webpage with an XS-leak. Impact:
The leaky resource attack is a targeted privacy attack, in which an individual browsing an attacker-controlled webpage can be uniquely identified. This is in contrast with other known de-anonymization techniques, such as third-party tracking (e.g., tracking pixels or tracking IPs) or social media fingerprinting, that do not provide this level of accuracy. As such, leaky resources can be abused in a variety of privacy-sensitive scenarios, including law enforcement gathering evidence regarding the online activity of individuals, oppressive governments tracking political dissidents, de-anonymizing reviewers for a conference paper, blackmailing individuals based on their online activity, or health insurance companies discriminating individuals based on their online activity.
Report details
-
Submitted
28 Jan 2021 21:38:12 UTC
-
Target Location
Bitbucket Cloud including Bitbucket Pipelines (https://bitbucket.org) -
Target category
Web App
-
VRT
Privacy Concerns
-
Priority
P5
-
Bug URL
https://bitbucket.org/{projectName}/{repoName}/raw/{commitId}/{fileName} -
Description
Greetings,
I am Mojtaba Zaheri, a doctoral candidate in Computer Science, affiliated with the NJIT Cybersecurity Research Center. Together with my doctoral dissertation advisor, Prof. Reza Curtmola, we are reaching out to perform responsible disclosure of a vulnerability present on the Bitbucket website. Please let us know if you have any comments regarding this disclosure.
Summary:
We have identified a leaky resource attack against several high-profile resource-sharing websites, including Bitbucket, that allows an attacker to infer the unique identity of a victim that visits an attacker-controlled website. This targeted privacy attack can have a significant impact on the privacy of individuals.
Even though previous work introduced the attack using images (i.e., leaky images [1]), in this report we show that the attack works with any resource that can be privately shared with the victim and can be rendered on a webpage. In particular, we show the attack also works with other media files, such as video and audio files. Thus, we generically refer to the attack as a leaky resource attack. An attacker exploiting these vulnerabilities can identify a user of the Bitbucket website while the user visits an attacker-controlled website, using the cookie(s) set by the Bitbucket website in her browser.
The leaky image attack [1] leverages the existence of a state-dependent URL (SD-URL) on the image-sharing website, i.e. a URL for which the response is different depending on the victim’s state with respect to the image-sharing website. For example, if the user is the targeted victim, the content will be loaded, otherwise, it will not be loaded. The attacker can learn information about this response based on an XS-leak that bypasses the Same-Origin Policy which normally prevents the attacker from reading the contents of a cross-origin response. [1] describes script-based and scriptless variants of the leaky image attack. The scriptless variant relies on the object HTML tag for the XS-leak, using this tag’s if-then-else behavior to enable the attack.
We reveal a new SD-URL for resources in Bitbucket service and introduce two new HTML-only XS-Leaks. We show that a leaky resource attack can be performed using video and audio HTML tags. The previously known scriptless attack was based on the object HTML tag, but we find that it is not reliable: It does not work against all vulnerable resource-sharing services and only works in some browsers. As opposed to this, we show that attacks based on the video and audio tags are very reliable, as they work against all the vulnerable services we identified and across all browsers we tested with (Firefox, Edge, Chrome).
We describe below the threat model, the exploit vector, and the actual steps that need to be followed on your website to set up a leaky resource attack. We also explain potential fixes.
Threat Model:
We consider attackers that can bring together the following necessary ingredients for a successful leaky resource attack:
- The attacker and the victim are users of the same resource sharing service.
- The resource sharing service allows its users to share resources privately with each other and authenticates users through cookies.
- The attacker convinces the victim to visit the attack page (which is controlled by the attacker) while the victim is logged into her account with the resource sharing service (which is not controlled by the attacker).
- The attacker can determine if the victim loaded the resources successfully.
The attack is effective because these requirements can be achieved in multiple ways and are within easy reach of the attacker. For requirement #1, the victim may have an account in Bitbucket; also, Bitbucket has free membership, and so the attacker can just create an account. For requirement #2, these are the de facto mechanisms for many of the resource sharing services. Requirement #3 can be achieved in multiple ways, including via phishing emails, or via a watering-hole approach. Requirement #4 is crucial for the attack and can be achieved as follows. The attack page contains a state-dependent URL (SD-URL) that points to content on the target website (i.e., Bitbucket). When a user makes a request for the SD-URL, the response is different depending on the user's state with respect to the Bitbucket website. For example, if the user is the targeted victim, the content will be loaded, otherwise, it will not be loaded. The attacker can learn information about this response based on an XS-leak that bypasses the Same-Origin Policy which normally prevents the attacker from reading the contents of a cross-origin response.
Attacks:
The new SD-URL we reveal can be exploited by a script-based XL-leak, but here we focus on scriptless XS-leaks, as privacy-aware users may disable scripts or use protection mechanisms that prevent script-based XS-leaks.
The pattern of the new SD-URL found is:
https://bitbucket.org/{projectName}/{repoName}/raw/{commitId}/{fileName}This SD-URL is valid until the resource is unshared or deleted.
Exploiting this SD-URL based on object tag HTML-only XS-Leak from [1]:
<object data ="https://bitbucket.org/{projectName}/{repoName}/raw/{commitId}/{fileName}" type ="image/png"> <object data ="Fallback-URL" type ="image/png"></object> </object>Communication method using the object HTML tag: If the outer object element (SD-URL) fails to load, then the fallback is to load the inner object element (Fallback-URL, controlled by the attacker). This fallback-based mechanism can be used to simulate an if-then-else control flow instruction in pure HTML. The attack does not work with browsers we tested (Firefox, Chrome, and Edge).
Here we describe the video and audio HTML tags as new XS-leaks that are reliable across all browsers we tested (Chrome/Edge before version 80.0, and Firefox 83.0).
<video width="320" height="240" controls autoplay muted> <source src="https://bitbucket.org/{projectName}/{repoName}/raw/{commitId}/{fileName}" type ="video/webm"> <source src="Fallback-URL" type ="video/webm"> </video>Communication Method using video HTML tag: If the first source (SD-URL) cannot be loaded, then the fallback is to load the second source (Fallback-URL, controlled by the attacker).
<audio width="320" height="240" controls autoplay> <source src="https://bitbucket.org/{projectName}/{repoName}/raw/{commitId}/{fileName}" type ="audio/ogg"> <source src="Fallback-URL" type ="audio/ogg"> </audio>Communication Method using audio HTML tag: If the first source (SD-URL) cannot be loaded, then the fallback is to load the second source (Fallback-URL, controlled by the attacker).
Normally, the source elements are used by website authors to specify multiple alternative media resources for media elements. However, these alternatives can be used to trigger a fallback behavior that mimics an if-then-else control flow. Both resources used in these tests have the type webm and ogg for video and audio tags respectively, but other video and audio file types can be used as well. By checking the HTTP Request Headers, the attacker can make sure whether the specific file type is supported by the browser, and so prepare an appropriate webpage.
It is worth mentioning that the reason why XS-leaks based on video and audio tags were not successful in some services when using Chrome/Edge browsers versions 80.0 and above is that different browsers behave inconsistently when the SameSite attribute is not set at all. Chromium-based browsers versions 80 and above treat cookies as if a lax SameSite attribute is set, whereas Firefox (tested up to version 83) treats them as if SameSite is set to none.
Steps to Reproduce:
The attacker first shares privately a resource with the target victim using a sharing service. The attacker then embeds a link to the privately shared resource on a webpage she controls. When a visitor loads that webpage, the resource will be successfully retrieved only if the visitor is the targeted victim, since only the victim is allowed to retrieve the resource (assuming the victim's browser is logged into the sharing service). By observing the success of loading the resource through an XS-leak, the attacker will know if the intended victim has visited the attacker's website.
- Upload and share privately the resource with the victim in Bitbucket.
- Open the resource in the browser to get the SD-URL.
- Embed the SD-URL in an attacker-controlled webpage with an XS-leak.
Impact:
The leaky resource attack is a targeted privacy attack, in which an individual browsing an attacker-controlled webpage can be uniquely identified. This is in contrast with other known de-anonymization techniques, such as third-party tracking (e.g., tracking pixels or tracking IPs) or social media fingerprinting, that do not provide this level of accuracy. As such, leaky resources can be abused in a variety of privacy-sensitive scenarios, including law enforcement gathering evidence regarding the online activity of individuals, oppressive governments tracking political dissidents, de-anonymizing reviewers for a conference paper, blackmailing individuals based on their online activity, or health insurance companies discriminating individuals based on their online activity.
-
Extra info
Fix:
-
Server-side defense:The SameSite cookie attribute can be used to impose restrictions when cookies can be sent. Although setting this cookie attribute to strict or lax could limit the attack surface in theory, our findings show that many popular sharing services are still vulnerable, because the attribute is either set to none or not enabled at all. A major reason for this is that the SameSite cookie attribute interferes with services provided by websites. Two examples are a watch later button on a YouTube video embedded in a non-YouTube website, and a website that embeds the GoogleMaps service, in order to show user-specific resources, such as saved and favorite locations on the map. As an additional drawback, when the SameSite attribute is not set, browsers have inconsistent default behaviors. Chromium-based browsers versions 80 and above treat cookies as if a lax SameSite attribute is set, whereas Firefox (tested up to version 83) treats them as if SameSite is set to none.
-
Client-side defense:We have devised a client-side defense that can be implemented as a browser extension and can thus be deployed immediately without buy-in from websites and browser vendors. The defense is included in a research article that is currently under submission for publication at an academic conference.
-
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 lack of the SameSite cookie attribute on Bitbucket's authentication cookies, combined with a state-dependent URL that returns different responses based on the user's authentication state.
Impact
An attacker could uniquely identify a victim who visits their website, which is a targeted privacy attack; however, the attack may be limited by browser cookie policies, as Chromium-based browsers from version 80 treat cookies as SameSite=Lax by default, potentially blocking the leak.
What the attacker needed
Attacker and victim are users of Bitbucket; victim is logged into Bitbucket; victim visits attacker-controlled page; attacker can share a resource privately with victim
The fix
The report suggests setting the SameSite cookie attribute to strict or lax, but notes that this may interfere with legitimate functionality and that many services remain vulnerable; a client-side defense via browser extension is also proposed.
How it was found
- Upload and share a resource privately with the victim on Bitbucket.
- Open the resource in the browser to obtain the state-dependent URL.
- Embed that URL in an attacker-controlled webpage using an XS-leak technique.
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.
When you share a file privately on Bitbucket, only the intended person can access it. The researchers found that an attacker can check whether a visitor to their website is that intended person by embedding the private file link in a way that reveals if it loads. This lets the attacker identify visitors without their knowledge.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.