Private job artifacts can be accessed by any user
Private job artifacts in a public project could be accessed by anonymous users through the `needs` keyword in another pipeline. An attacker could read confidential variables stored in private artifacts.
GitLab
Originally disclosed on GitLab
- Fixed in 2 months
- Disclosed after 2 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 #2456845 by js_noob on 2024-04-09, assigned to GitLab Team:
Report | Attachments | How To Reproduce
Report
Summary
Hello team, a user in a project can set the artifacts of a job to be private so they're not accessible by any unauthorized user, from the docs:
To deny read access to artifacts in public pipelines for anonymous, guest, and reporter users, set
artifacts:publictofalse
This is working as expected in the UI and the API, however, anonymous unauthorized users can still access those private artifacts using the needs keyword, in another pipeline.
NB: The following POC just shows a simple example of a static value, however, artifacts especially the env one usually contain confidential variables/info.
Steps to reproduce
As the victim:
- Create a new group and apply the ultimate trial to it
- Create a public project in that group
- Create a
.gitlab-ci.ymlfile in that project, this job creates an ENV artifact, that's private and isn't accessible by unauthorized
build_vars:
stage: build
script:
- echo "BUILD_VERSION=hello" >> build.env
artifacts:
reports:
dotenv: build.env
public: false
- When the pipeline finishes, verify the creation of a new artifact

As the attacker:
- Navigate to that project's artifacts page and verify that you can't download the
.envartifact - Create a new group, and apply the ultimate trial to it
- Create a project in that group, with the following
.gitlab-ci.ymlfile
my_job:
script:
- echo "$BUILD_VERSION"
needs:
- project: VICTIM/PROJECT
job: build_vars
ref: main
artifacts: true
- Notice the triggered pipeline, it should contain the value of the
BUILD_VERSIONvariable that's saved in a private artifact
Example
What is the current bug behavior?
Private artifacts are accessible using the needs keyword.
What is the expected correct behavior?
Private artifacts shouldn't be accessible using the needs keyword.
Output of checks
This bug happens on GitLab.com
Impact
Disclosure of private job artifacts to unauthorized users.
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
How To Reproduce
Please add reproducibility information to this section:
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 access control check for private artifacts was not applied when artifacts are fetched via the `needs` keyword from another pipeline.
Impact
Disclosure of private job artifacts to unauthorized users.
What the attacker needed
Victim has a public project with private artifacts; attacker can create a group and project and run pipelines
How it was found
- As the victim, create a group and apply the ultimate trial to it.
- Create a public project in that group.
- Add a `.gitlab-ci.yml` file that creates a private ENV artifact.
- Run the pipeline and verify the artifact is created.
- As the attacker, navigate to the project's artifacts page and confirm you cannot download the `.env` artifact.
- Create a new group and project, and add a `.gitlab-ci.yml` that uses `needs` to fetch the victim's artifact.
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 job can produce files called artifacts, and you can mark them private so only certain people can see them. The report shows that even if an artifact is private, someone outside the project can still get it by referencing it from a different pipeline using a special keyword. This means private data 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.