Skip to content
XSS Disclosed report Intermediate

Stored XSS in Shared runners text

A stored cross-site scripting vulnerability existed in GitLab's 'Shared runners text' setting, where an administrator could insert HTML that was rendered without sanitisation on project and group CI/CD settings pages. An attacker with administrator access could execute arbitrary JavaScript in the context of other users viewing those pages, potentially stealing cookies or redirecting to malicious sites.

GitLab

Originally disclosed on GitLab

  • Fixed in 3 months
  • Disclosed after 3 months

HackerOne report #1174942 by solov9ev on 2021-04-26, assigned to GitLab Team:

Report | Attachments | How To Reproduce

Report

Summary

Hi, Security Team!

I found stored xss when the user fills in the text "Shared runners text".

Steps to reproduce
  • Run Gitlab docker run --detach --hostname gitlab.example.com --publish 443:443 --publish 80:80 --publish 22:22 --name gitlab gitlab/gitlab-ce:latest (GitLab Community Edition 13.11.1)
  • Go to /admin/application_settings/ci_cd#js-ci-cd-settings
  • Insert the malicious payload in the Shared runners text box : <img src=1 onerror=confirm(document.cookie)>
1.png
1.png From the original on GitLab
  • And then go to the settings of the group or project (/group-1/project-1/-/settings/ci_cd) in the section Settings -> CI/CD
2.png
2.png From the original on GitLab

Vulnerable piece of code that displays a value:

Ruby
= markdown_field(Gitlab::CurrentSettings.current_application_settings, :shared_runners_text)  
3.png
3.png From the original on GitLab

But elsewhere, for example, in the description of the help page, the malicious load is already being processed:

4.png
4.png From the original on GitLab
5.png
5.png

I understand that you need to have administrator access to inject a malicious load. However, in conjunction with social engineering, implementation can be achieved.

Thank you!

Impact

With this vulnerability, an attacker can for example steal users cookies or redirect users on malicious website.

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

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

The application rendered the 'shared_runners_text' setting using a markdown helper that did not sanitise HTML, allowing script injection.

Impact

An attacker with administrator access could steal users' cookies or redirect them to malicious websites, though the need for admin access limits the attack to social engineering scenarios.

What the attacker needed

Administrator access to GitLab

How it was found

  1. Run a GitLab instance using Docker.
  2. Go to the admin CI/CD settings page.
  3. Insert a malicious payload into the 'Shared runners text' box.
  4. Visit a group or project's CI/CD settings page to trigger the payload.

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.

Stored cross-site scripting (XSS) is when a website saves malicious code (like JavaScript) and later shows it to other users without cleaning it. Here, an admin could put a script into a settings field, and it would run in the browsers of anyone who visited certain project settings pages. This could let the attacker steal login cookies or redirect users to harmful sites.

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.