Skip to content
Info disclosure Disclosed report Intermediate

Insufficient checks allow protected variables to get passed on to non-protected branches or tags

Protected CI/CD variables in GitLab multi-project pipelines were passed to downstream jobs running on unprotected branches. An attacker with access to an unprotected branch could read sensitive deployment credentials and tokens.

GitLab

Originally disclosed on GitLab

  • Fixed in 23 months
  • Disclosed after 23 months

HackerOne report #1044397 by vaib25vicky on 2020-11-26, assigned to @cmaxim:

Report | How To Reproduce

Report

Summary

In multi-project pipelines, it is possible for protected variables to get passed to jobs that run on unprotected branches. Allowing untrusted users getting unintended access to sensitive information like deployment credentials and tokens.

Steps to reproduce
  • Create two projects and for PoC keep them public
  • Create multi-project pipeline where in upper project .gitlab-ci.yml file is

variables:  
  MY_VARIABLE: $TOKEN

trigger-downstream:  
  trigger: <path_to_downstream_project>

where $TOKEN is an environment variable which is protected

  • In other project, .gitlab-ci.yml file is

job A:  
  script:  
    - echo "$MY_VARIABLE" 


  • Make sure the default master branch of the downstream project is unprotected
  • Now, running pipeline in upper project will pass on the protected variable to downstream pipeline which runs on the unprotected branch
Impact

The vulnerability allows protected variables to pass & accessible to the jobs that run on unprotected branches. This allows untrusted users getting unintended access to sensitive information like deployment credentials and tokens.

There are different scenarios where this vulnerability can effects the users like

  • Projects having somewhat complex .gitlab-ci.yml file can accidentally leaks their protected variables
  • In future if the downstream project changes and the protected branch becomes unprotected then this bug can allows variables to pass on to the jobs that runs on unprotected branch
  • Groups with multiple projects can leak their secret protected variables to untrusted users
What is the current bug behavior?

Protected variables are getting passed to the jobs that run on unprotected branches in multi-project pipelines setup

What is the expected correct behavior?

When variables passed on to from upstream pipeline to downstream pipeline there should be a check to confirm whether the downstream pipeline runs on protected branch or not

Output of checks

This bug happens on GitLab.com

Impact

Insufficient checks allow protected variables to be accessible and passed to the jobs that run on unprotected branches or tags.

Thank you,
Vaibhav

How To Reproduce

Please add reproducibility information to 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 system did not verify whether the downstream pipeline's branch was protected before passing protected variables from the upstream pipeline.

What the attacker needed

GitLab.com account; Two projects with multi-project pipeline; Protected variable in upstream project; Downstream default branch unprotected

How it was found

  1. Create two public projects.
  2. In the upstream project's .gitlab-ci.yml, define a variable that references a protected environment variable and add a trigger job for the downstream project.
  3. In the downstream project's .gitlab-ci.yml, add a job that echoes the passed variable.
  4. Ensure the downstream project's default branch is unprotected.
  5. Run the pipeline in the upstream project; the protected variable is passed to the downstream job on the unprotected branch.

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.

In GitLab, protected variables are secrets that should only be available to jobs running on protected branches (like the main branch). This report shows that when one project triggers a pipeline in another project, those secrets could leak to jobs running on unprotected branches, which less trusted users can modify.

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.