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 textbox :<img src=1 onerror=confirm(document.cookie)>

- And then go to the settings of the group or project (
/group-1/project-1/-/settings/ci_cd) in the sectionSettings -> CI/CD

Vulnerable piece of code that displays a value:
= markdown_field(Gitlab::CurrentSettings.current_application_settings, :shared_runners_text)

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


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:
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
- Run a GitLab instance using Docker.
- Go to the admin CI/CD settings page.
- Insert a malicious payload into the 'Shared runners text' box.
- 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.