Backend: Leaking CI variables via fork MRs
A fork merge request can cause the backend to process a malicious CI configuration that fetches external includes, leaking unprotected CI variables. An attacker could obtain these variables by sending a crafted link to a project member.
GitLab
Originally disclosed on GitLab
- Fixed in 3 months
- Disclosed after 3 months
Summary
This confidential ~security issue is an SSOT for all of the nearly identical work that needs to happen in:
The related issues list
- https://gitlab.com/gitlab-org/gitlab/-/issues/393054
- https://gitlab.com/gitlab-org/gitlab/-/issues/394964
- https://gitlab.com/gitlab-org/gitlab/-/issues/416255
All these issues have the same baseline; forked MR and running YamlProcessor;
- Attacker forks a public project
- Attacker makes changes to gitlab-ci.yml to leak variables and create an MR to the public project
- Attacker sends one of these links to a project member;
- https://gitlab.com/gitlab-org/gitlab/-/issues/393054 -> blob page of gitlab-ci.yml with the attacker sha (
BlobViewer::GitlabCiYml) - https://gitlab.com/gitlab-org/gitlab/-/issues/394964 -> CI editor page with the attacker sha (
Ci::Lint) - https://gitlab.com/gitlab-org/gitlab/-/issues/416255 -> new pipeline page with the attacker sha (
Ci::ListConfigVariablesService)
- https://gitlab.com/gitlab-org/gitlab/-/issues/393054 -> blob page of gitlab-ci.yml with the attacker sha (
- Backend runs
Gitlab::Ci::YamlProcessorand leaks the unprotected variables by fetching external includes.
Proposal
Two options were recently shared to fix this problem in https://gitlab.com/gitlab-org/gitlab/-/issues/394964#note_1437662805
Additional details
<!-- _NOTE: If the issue has addressed all of these questions, this separate section can be removed._ -->Some relevant technical details, if applicable, such as:
- Does this need a ~"feature flag"?
- Does there need to be an associated ~"instrumentation" issue created related to this work?
- Is there an example response showing the data structure that should be returned (new endpoints only)?
- What permissions should be used?
- Is this EE or CE?
- EE
- CE
- Additional comments:
Links/References
~"Weakness::CWE-200"
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
Impact
Unprotected CI variables could be leaked to an attacker if a project member visits a crafted link.
What the attacker needed
Public project; attacker can fork project; victim clicks a link
How it was found
- Attacker forks a public project
- Attacker makes changes to gitlab-ci.yml to leak variables and create an MR to the public project
- Attacker sends one of these links to a project member
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.
When someone forks a project, they can change the CI configuration file. If a project member views that changed file through certain pages, the system processes it and may fetch external content, which can leak secret variables. This means an attacker could steal sensitive information by tricking a member into clicking a link.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.