Skip to content
Access control Disclosed report Intermediate

User with developer role (group) can leak group CI/CD variables through GitLab project import using tags protection

A user with the developer role in a GitLab group could export a project with protected tags and import it into another group, causing the protection settings to be imported as-is. This allowed the user to create a release with a protected tag and trigger a pipeline that leaked masked group CI/CD variables.

GitLab

Originally disclosed on GitLab

  • Fixed in 22 days
  • Disclosed after 22 days

⚠️ 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 #1940141 by js_noob on 2023-04-09, assigned to @greg:

Report | Attachments | How To Reproduce

Report

Summary

Hello team, a user with a developer role (group) can steal protected group/project CI/CD variables by adding protected tags on a project, exporting it, and then importing it into a group where he has a developer role, the protection gets imported as it is. This is done with no victim interaction needed.

Steps to reproduce
  1. Create 2 accounts
  2. Create a group with account A and masked CI/CD group variables (Group settings -> CI/CD -> Variables)
image.png
image.png From the original on GitLab
  1. Create a personal project with account B and add .gitlab-ci.yml file with the following content
image: ruby:latest

job_name:    
 script:    
   - echo $VAR   
  1. In the same project from account B create tags protection (Project settings -> Repository -> Protected tags), with the following v* and `Developers + Maintainers
image.png
image.png From the original on GitLab
  1. Export the project and save the tar/zip file
  2. Invite account B (developer) to account A's (owner) group
  3. Upload the project file (from step 5) to account A's group with account B
  4. Create a new release in the newly created/imported project with the following
    1. tag: v.1.0.0
    2. Release title: v.1.0.0
  5. Verify the successful creation, navigate to the job/pipeline logs and verify the group CI/CD vars being leaked
Expected Behavior

Protected tags should either be blank by default or just be limited to maintainers (this is done for protected branches).

Video/POC

Redacted

Impact

Users with developer role (group) can steal masked group and project CI/CD variables

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

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, protected tag settings were imported without validating the importer's permissions, allowing a developer to create protected tags and trigger pipelines that expose group variables.

Impact

A user with the developer role could steal masked group and project CI/CD variables.

What the attacker needed

Two GitLab accounts; Developer role in a group; Group has masked CI/CD variables

The fix

Protected tags should be blank by default or limited to maintainers, as is done for protected branches.

How it was found

  1. Create two accounts and a group with masked CI/CD variables using the first account.
  2. With the second account, create a personal project with a CI configuration that echoes a variable.
  3. Add a protected tag pattern allowing developers to create tags.
  4. Export the project and save the archive.
  5. Invite the second account as a developer to the first account's group.
  6. Import the project into the group and create a release with a tag matching the protected pattern.

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, CI/CD variables are secret values used in pipelines. A developer role normally cannot see these secrets. The bug let a developer copy a project with special tag protections into another group, then create a release that ran a pipeline and printed the secrets in the job log.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.