Skip to content
Access control Disclosed report Beginner

Private artifacts of a public project are accessible via the jobs API for any authenticated user

A public project's CI job artifacts were meant to be private when the artifacts public flag was set to false, but any authenticated user could still download them through the jobs API, exposing secrets or credentials.

GitLab

Originally disclosed on GitLab

  • Fixed in 10 months
  • Disclosed after 10 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 #2780353 by albatraoz on 2024-10-14, assigned to @greg:

Report | Attachments | How To Reproduce

Report

Summary

According to the documentation:

To deny read access to artifacts in public pipelines for anonymous, guest, and reporter users, set artifacts:public to false:

https://docs.gitlab.com/ee/ci/yaml/#artifactspublic

It was observed that any authenticated user could access and download artifacts in the public pipelines even If the artifacts' public flag is set to false in the CI/CD config.

Steps to reproduce

  1. As a victim account A, create a public GitLab project in a Gitlab group with ultimate license.
  2. Now add the following content to the .gitlab-ci.yml file in the repository to create a CI/CD pipeline with private artifacts.
YAML
test:  
  script: ["echo $CI_JOB_TOKEN > secret.txt"]  
  artifacts:  
    paths: ['secret.txt']  
    public: False  
  1. Now with an attacker account B, try to access the job artifacts, the access would be denied.
  2. As an attacker account B, open the following URL on the browser. Replace the JOB_ID with the job id of the pipeline from step 2.
    https://gitlab.com/api/v4/jobs/[JOB_ID]/artifacts?artifact_format=zip&artifact_type=archive
  3. A file would be downloaded. Just rename the file to a zip file and extract it. You will see that you can access and download artifacts as you can read the content of the secret.txt file.

POC

<redacted>

Impact

Accessing private artifacts of public pipelines in GitLab can expose sensitive information, such as secrets, credentials, or proprietary code, leading to unauthorized access.

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

  • <redacted>

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 jobs artifacts API endpoint did not enforce the artifacts:public setting that the UI and other endpoints respected.

Impact

Private artifacts of public pipelines could be downloaded by any authenticated user, exposing secrets, credentials or proprietary code.

What the attacker needed

An authenticated account; victim has a public project with private artifacts

How it was found

  1. Create a public project in a group with an ultimate licence.
  2. Add a CI config that produces an artifact with public set to false.
  3. Confirm the normal job artifacts page denies access to a second account.
  4. Request the jobs API artifacts endpoint for that job id as the second account.
  5. Download the returned file, rename it to a zip and extract it to read the secret.

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, a pipeline can produce files called artifacts, and a project owner can mark them private so only certain people see them. The report shows that a different part of the site, the jobs API, did not check that private setting, so any logged-in user could still download the files. That means secrets written into those files could leak.

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.