Skip to content
XSS Disclosed report Intermediate

Double linking cause XSS (but blokeced by CSP in gitlab.com)

A double-linking bug in GitLab's URL rendering allowed HTML injection, and potentially XSS, when a crafted Gemfile was previewed. On gitlab.com the XSS was blocked by CSP, but HTML and CSS injection remained possible.

ooooooo_q Follow

Originally disclosed on HackerOne

  • Disclosed after 3 months

Summary

URL display on Gitlab.com is currently broken.

There is a risk of XSS due to double conversion of URLs into links. However, 12.5 incorporating the fix has not yet been released and is blocked by CSP at gitlab.com.

Steps to reproduce

  1. Login to gitlab.com
  2. Create new project
  3. Create a file with the following contents as Gemfile
  4. Previe the Gemfile
  5. You can see in the developer tool that javascript execution has been blocked by CSP.
Ruby
gem '<img/src/onerror=alert(location)>', '2'

Examples

The above code is converted to HTML as shown below and connected to XSS via the img tag.

HTML
<span class="s1">'<a href="<a href=" https:="" rubygems.org="" gems="" "="">https://rubygems.org/gems/</a><img src="" onerror="alert(location)">" rel="nofollow noreferrer noopener" target="_blank"&gt;&lt;img/src/onerror=alert(location)&gt;'</span>

What is the current bug behavior?

There is a problem with this MR (https://gitlab.com/gitlab-org/gitlab/merge_requests/18305/diffs) that was captured by Milestone 12.5.

The issue is here. https://gitlab.com/gitlab-org/gitlab/issues/35120

What is the expected correct behavior?

It is expected that there will be no processing that links the URL in the screen twice. Probably this MR. https://gitlab.com/gitlab-org/gitlab/merge_requests/19464

Relevant logs and/or screenshots

__________2019-11-05_6.10.27.png
__________2019-11-05_6.10.27.png From the original on HackerOne

screenshots https://gitlab.com/gitlab-org/gitlab/blob/master/Gemfile

Output of checks

This bug only occurs on GitLab.com .

Results of GitLab environment info

The 12.5 version has not yet been released and will not occur in other environments.

Impact

Since gitlab.com is blocked by CSP, there is almost no risk as XSS. There are dangers of HTML injection and CSS injection.

If this issue is not fixed and a 12.5 release is made, XSS can occur in Gitlab CE / EE.

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

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 URL auto-linking logic ran twice on the same text, so the HTML it inserted the first time was treated as input the second time and its escaped characters were turned back into live markup.

Impact

On gitlab.com the XSS was blocked by CSP, leaving only HTML and CSS injection; if the fix were not released, a 12.5 release could allow XSS in GitLab CE and EE.

What the attacker needed

A gitlab.com account; ability to create a project and file

The fix

The text references a merge request intended to stop the double linking, but does not state that it was deployed.

How it was found

  1. Log in to gitlab.com.
  2. Create a new project.
  3. Create a file named Gemfile with crafted content.
  4. Preview the Gemfile.
  5. Observe in the developer tools that JavaScript execution was blocked by CSP.

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 GitLab shows a file, it turns web addresses into clickable links. A bug made it do this twice, so a specially crafted line in a file could sneak in extra HTML, including a script-like image tag. On the main GitLab site a security feature called CSP stopped the script from running, but the page could still be altered.

What is XSS?

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

More by ooooooo_q

View all

53 more disclosed reports, best first.

More from GitLab

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.