Skip to content
XSS Disclosed report Intermediate

Reflected XSS discloses private Gitlab-org pages

A reflected cross-site scripting flaw existed on the gitlab-org GitLab Pages subdomain, in a storybook demo of a safe-HTML directive. An attacker could use it to make a logged-in team member's browser fetch and exfiltrate private pages published under that subdomain.

GitLab

Originally disclosed on GitLab

  • Fixed in 10 months
  • Disclosed after 10 months

HackerOne report #968459 by rpadovani on 2020-08-27, assigned to @ngeorge1:

Report | How To Reproduce

Report

Summary

There is a reflected XSS over https://gitlab-org.gitlab.io (your organization subdomain).

While I appreciate that https://gitlab.io is out of scope, I think this is of your interest anyway: Gitlab Pages access cookies are linked to the subdomain. A reflected XSS allows the attacker to access all the content published under the https://gitlab-org.gitlab.io.

While the gitlab pages cookie is http-only (so it cannot be extracted), it is still sent to any request to https://gitlab-org.gitlab.io. This means the attacker can perform a fetch request over any https://gitlab-org.gitlab.io, including the private ones, and exfiltrate the content of the page.

To do so, of course, a member of the gitlab-org team has to visit the page while she has logged in another private gitlab-org website.

I haven't exploited the issue, so it's hard to understand how many private Gitlab Pages your team has, but I have found at least one that I cannot normally access, and I would be able to access exploiting this XSS: https://gitlab-org.gitlab.io/-/gitlab/-/jobs/65667843/artifacts/coverage.html

Steps to reproduce

The issue is in https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/directives-safe-html-directive--default

To demonstrate how the safe directive works, you can inject an XSS. Moreover, there is a way to persist the XSS in the URL:

https://gitlab-org.gitlab.io/gitlab-ui/iframe.html?id=directives-safe-html-directive--default&knob-Unsafe%20HTML=%3Cimg%20src=%22notValidUrl%22%20onerror=alert(%27xss%27)%3E

Impact

All private Gitlab Pages published under the gitlab-org organization are not private anymore. The impact is based on how much do you use this feature.

Also, if you plan to publish this documentation in future under one of your domains, it would be a problem :-)

Impact

All private Gitlab Pages published under the gitlab-org organization are not private anymore. The impact is based on how much do you use this feature.

How To Reproduce

Please add reproducibility information to this section:

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

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 storybook demo of the safe-HTML directive rendered a URL-supplied knob value as raw HTML instead of sanitising it.

Impact

Private GitLab Pages under the gitlab-org organisation could be read by an attacker, but only if a logged-in team member visited the crafted page; the reporter did not exploit it and the impact depends on how many private pages exist.

What the attacker needed

Victim is a logged-in gitlab-org member; victim visits a crafted link; private pages exist on the subdomain

How it was found

  1. Open the gitlab-ui storybook page for the safe-html directive.
  2. Supply a crafted value for the Unsafe HTML knob that contains an event handler.
  3. Load the resulting iframe URL so the injected script runs in the gitlab-org.gitlab.io origin.

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.

Cross-site scripting (XSS) is when a website runs code an attacker supplied, usually JavaScript, inside a victim's browser. Here the demo page took text from the URL and inserted it into the page without cleaning it, so a crafted link could run code. Because the browser still sends the site's login cookie with requests, that code could read private pages the victim was allowed to see.

What is XSS?

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

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.