Skip to content
Access control Disclosed report Intermediate

Unauthenticated IP allowlist bypass when accessing job artifacts through gitlab pages at `{group_id}.gitlab.io`

GitLab's IP allowlist for groups did not apply to job artifacts served through the GitLab Pages domain, allowing unauthenticated users outside the allowed IP range to access them if they knew the job ID. An attacker could obtain job IDs from email notifications and then download artifacts from any IP address.

joaxcar Follow

Originally disclosed on HackerOne

Medium 5.9 View original
  • Triaged in 5 days
  • Fixed in 55 days
  • Paid in 5 days
  • Disclosed after 4 months

Summary

An owner of a group can restrict access to the group, subgroups and projects to only work from a specific IP range. See documentation link

To ensure only people from your organization can access particular resources, you can restrict access to groups by IP address.

This will restrict most actions, but have some caveats described in the documentation (which we will use to leak job IDs).

One thing that is restricted is access to pipeline job artifacts, both through the API and through the UI. But there exists a feature in GitLab that is used to "preview" HTML artifacts safely. GitLab exposes pipeline job artifacts for preview under the pages domain gitlab.io

What I have seen, this is for rendering HTML files, but it gives access to the complete artifact. This endpoint is not restricted by the IP block, and thus leaks job artifacts to users outside the IP range. Given that the IP block should restrict the group from users outside the IP range there is a high risk that projects protected this way have visibility Public, when this is the case these artifacts are leaked to unathenticated users outside the IP range.

To view the artifact files, a user would need access to the ID of the pipeline job. This makes the attack harder to pull off. But as IP restricted groups/projects are a bit leaky with their information, these IDs can be found in different ways. One way the job ID is leaked is through email notifications. If a user have enabled notifications on "pipeline finished" on the IP blocked project, then these job IDs will get sent to the user's email when a pipeline have finished. The user can then access the artifacts from any IP using the job ID from the email.

There might be other places where job IDs leak out. But the important thing is that the data is accessible to anyone with the link.

Steps to reproduce

  1. Create a user called victim and log in to Gitlab.com
  2. Create a public group with at least Premium subscription (create an ultimate trail if needed), lets call it group01
  3. Create a public project in the group, lets call it project01
  4. In the project create two files

hidden.json

JSON
{
   "hidden": "hidden"
}

and .gitlab-ci.yml

YML
data:
  artifacts:
    paths:
    - ./
    expire_in: 2 weeks
  1. When the files are created a pipeline job will run.
  2. Go to gitlab.com/group01/project01/-/pipelines and click on the button status done, click on the job data and then on "browse" under job artifacts
  3. You should now be able to click and download the artifact file. The URL should look like
https://gitlab.com/group01/project01/-/jobs/2493429745/artifacts/browse

and the file should be accessible like

https://gitlab.com/group01/project01/-/jobs/2493429745/artifacts/file/hidden.json
  1. Now go to group settings https://gitlab.com/groups/group01/-/edit and expand "Permissions and group features"
  2. Scroll down to "Allow access to the following IP addresses" and enter 1.1.1.1 and click enter (as owner you will always have access to this settings page so dont worry about the IP)
  3. Click save
  4. Now go back to the artifact URL and file URL and see that you will get a 404 error, no access anymore
  5. Now go to (change the ID)
https://group01.gitlab.io/-/project01/-/jobs/2493429745/artifacts/hidden.json
  1. You should see the content of the artifact file!
  2. Open a new browser, or log out, visit the same site. The artifact is shown unauthenticated

Impact

Users can access pipeline job artifacts in groups from restricted IP addresses

Examples

This is a public project with an IP restriction. You should not be able to see the files

https://gitlab.com/joaxcarultimate3/teat3/-/jobs/2547216908/artifacts/browse

This is the hidden file accessible to anyone, any IP

https://joaxcarultimate3.gitlab.io/-/teat3/-/jobs/2547216908/artifacts/hidden.json

What is the current bug behavior?

Pipeline job artifacts are exposed without IP restriction on gitlab pages domain

What is the expected correct behavior?

The files should not be exposed

Output of checks

This bug happens on GitLab.com

Impact

Pipeline artifacts are leaked from IP restricted groups to possible unauthenticated users

The original report as published on HackerOne, by joaxcar. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

GitLab groups can be restricted so that only people coming from a specific IP range can access the group, its subgroups and its projects. The group documentation describes the feature as a way to "ensure only people from your organization can access particular resources" by restricting access to groups by IP address.

The restriction covers most actions, but the documentation itself lists caveats, and the report uses one of those caveats to leak pipeline job IDs. One thing the IP restriction does cover is access to pipeline job artifacts, both through the API and through the UI: once the allowlist is set, the artifact browse and file URLs return a 404.

GitLab also has a feature that previews HTML artifacts safely, exposing pipeline job artifacts for preview under the pages domain, gitlab.io. The researcher observed that this is intended for rendering HTML files but that it gives access to the complete artifact. That endpoint is not covered by the IP block.

Setup

The reproduction uses a public group with at least a Premium subscription (an Ultimate trial works) and a public project inside it. The reproduction uses a public group and a public project inside it, because the researcher notes that projects protected this way are likely to have Public visibility, and in that case the artifacts are leaked to unauthenticated users outside the IP range.

No special tooling is needed: a browser, a GitLab.com account, and the ability to create a group and a project are enough.

Finding it

The IP allowlist blocks artifact access through the normal GitLab.com paths, but the same artifacts are served from the pages domain, which is not restricted by the IP block. Because the pages preview exposes the complete artifact rather than only rendering HTML, the file contents are reachable from any IP.

The remaining obstacle is the job ID: the artifact URL contains the pipeline job ID, so an attacker needs to know it. The report notes that IP restricted groups and projects are "a bit leaky with their information" and that job IDs can be found in different ways. One concrete way is email notifications: if a user has enabled notifications on "pipeline finished" for the IP blocked project, the job IDs are sent to that user's email when a pipeline finishes, and the user can then access the artifacts from any IP using the job ID from the email. The report says there might be other places where job IDs leak out, but the important point is that the data is accessible to anyone with the link.

Exploitation

Step 1: Create the victim account and group

  1. Create a user called victim and log in to GitLab.com.
  2. Create a public group with at least a Premium subscription (create an Ultimate trial if needed), called group01.
  3. Create a public project in the group, called project01.

Step 2: Create the artifact files

In the project, create two files. The first is hidden.json:

JSON
{
   "hidden": "hidden"
}

The second is .gitlab-ci.yml:

YML
data:
  artifacts:
    paths:
    - ./
    expire_in: 2 weeks

The job named data collects the whole project directory (./) as artifacts and keeps them for two weeks.

Step 3: Run the pipeline and browse the artifact

When the files are created, a pipeline job runs. Go to gitlab.com/group01/project01/-/pipelines, click the status done button, click the job data, and then click "browse" under job artifacts. At this point the artifact file can be clicked and downloaded. The URL looks like:

Text
https://gitlab.com/group01/project01/-/jobs/2493429745/artifacts/browse

and the file is accessible like:

Text
https://gitlab.com/group01/project01/-/jobs/2493429745/artifacts/file/hidden.json

Step 4: Apply the IP allowlist

Go to the group settings at https://gitlab.com/groups/group01/-/edit and expand "Permissions and group features". Scroll down to "Allow access to the following IP addresses", enter [redacted] and press enter. As the owner you always have access to this settings page, so the entered address does not lock you out. Click save.

Step 5: Confirm the block on the normal paths

Go back to the artifact URL and the file URL. Both now return a 404 error: there is no access any more through the GitLab.com paths.

Step 6: Reach the same artifact through the pages domain

Change the ID in the following URL to the job ID from step 3:

Text
https://group01.gitlab.io/-/project01/-/jobs/2493429745/artifacts/hidden.json

The content of the artifact file is shown. Opening a new browser, or logging out and visiting the same site, still shows the artifact, so it is served unauthenticated.

Root cause

The IP allowlist blocks artifact access on the GitLab.com application paths, but the pages domain that previews artifacts is not covered by the IP block. The preview feature is meant for rendering HTML artifacts, yet it exposes the complete artifact, so any file in the artifact, not just HTML, can be fetched. The pages endpoint is not restricted by the IP block, so the group owner's restriction does not apply there.

Knowing the job ID makes the attack harder to pull off, but job IDs leak through channels such as pipeline-finished email notifications, and the artifact is accessible to anyone who has the link.

Impact

Users can access pipeline job artifacts in groups that are restricted to specific IP addresses. When the protected project is Public, which the researcher says is a high risk for groups protected this way, the artifacts are leaked to unauthenticated users outside the IP range. The attack requires knowledge of the pipeline job ID, which can be obtained through leaks such as email notifications, and the report notes there might be other leak channels. The report was rated medium severity with a CVSS score of 5.9.

Fix

The report states the expected correct behaviour: the files should not be exposed. It does not describe a specific code change or a fix that was applied.

Variants to test

  • Other artifact-serving paths. Look for any other domain or route that serves job artifacts outside the main application, such as preview or rendering endpoints, and request a known artifact file through it while the group IP allowlist is active. A positive result is the file content being returned where the GitLab.com artifact URL returns 404.
  • Non-HTML artifact types. The preview feature is intended for HTML, so try other file types in the artifact (JSON, text, configuration files) through the pages path. A positive result is any non-HTML file being served in full.
  • Unauthenticated access. Repeat the request in a fresh browser or logged out. A positive result is the artifact being returned without a session.
  • Job ID leak channels. Check pipeline-finished email notifications and other places where job IDs appear for an IP restricted project, then use a leaked ID against the pages path. A positive result is a working artifact URL built from an ID obtained outside the restricted network.
  • Other IP restricted resources. Apply the same reasoning to other features that serve project data from separate domains, checking whether the allowlist is enforced there. A positive result is restricted content being reachable from an address outside the allowlist.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 11 min read.

What happened, in plain words

GitLab is a website where teams keep their code and run automated tasks on it. A group owner can tell GitLab: only let people in from a certain set of network addresses (an IP range). That is like putting a bouncer on the door who only lets in people from a particular street. The report shows that one side door was left open: a special preview address on the gitlab.io domain still handed out the files that the bouncer was supposed to protect, even to people who were not logged in at all.

Context

A GitLab group is a container for projects, and projects contain code and pipelines. A pipeline is a series of automated jobs that GitLab runs for you, for example to build or test something. A job can produce files as output, and those files are called artifacts. Think of a job as a cook and the artifacts as the dishes that come out of the kitchen.

GitLab groups can be restricted so that only people coming from a specific IP range can access the group, its subgroups and its projects. An IP address is the number that identifies a computer on a network, a bit like a postal address for a device. An IP range is a block of such addresses, for example all the addresses used by one company's office. The group documentation describes the feature as a way to "ensure only people from your organization can access particular resources" by restricting access to groups by IP address.

The restriction covers most actions, but the documentation itself lists caveats, and the report uses one of those caveats to leak pipeline job IDs. A job ID is the number GitLab gives each job so it can be found again, like an order number. One thing the IP restriction does cover is access to pipeline job artifacts, both through the API and through the UI. The UI is the normal web pages you click around in. The API is the same service talking to programs instead of people: a set of addresses that return data rather than a page you look at. Once the allowlist is set, the artifact browse and file URLs return a 404. A 404 is the standard web answer for "there is nothing here", the same message you get for a page that does not exist.

GitLab also has a feature that previews HTML artifacts safely, exposing pipeline job artifacts for preview under the pages domain, gitlab.io. HTML is the language web pages are written in, and a preview means GitLab shows the file as a web page instead of making you download it. The researcher observed that this is intended for rendering HTML files but that it gives access to the complete artifact. That endpoint is not covered by the IP block. An endpoint is simply one address on a server that answers requests, like one counter in a large office.

Setup

The reproduction uses a public group with at least a Premium subscription (an Ultimate trial works) and a public project inside it. A subscription is a paid plan, and a trial is a free temporary version of a higher plan. The reproduction uses a public group and a public project inside it, because the researcher notes that projects protected this way are likely to have Public visibility, and in that case the artifacts are leaked to unauthenticated users outside the IP range. Public means anyone on the internet can see it, and unauthenticated means the visitor has not logged in, so GitLab does not know who they are.

No special tooling is needed: a browser, a GitLab.com account, and the ability to create a group and a project are enough.

Finding it

The IP allowlist blocks artifact access through the normal GitLab.com paths, but the same artifacts are served from the pages domain, which is not restricted by the IP block. Because the pages preview exposes the complete artifact rather than only rendering HTML, the file contents are reachable from any IP.

The remaining obstacle is the job ID: the artifact URL contains the pipeline job ID, so an attacker needs to know it. A URL is the address you type in the browser bar. The report notes that IP restricted groups and projects are "a bit leaky with their information" and that job IDs can be found in different ways. One concrete way is email notifications: if a user has enabled notifications on "pipeline finished" for the IP blocked project, the job IDs are sent to that user's email when a pipeline finishes, and the user can then access the artifacts from any IP using the job ID from the email. The report says there might be other places where job IDs leak out, but the important point is that the data is accessible to anyone with the link.

Exploitation

Step 1: Create the victim account and group

  1. Create a user called victim and log in to GitLab.com. The victim is the pretend user whose protected data we are testing.
  2. Create a public group with at least a Premium subscription (create an Ultimate trial if needed), called group01.
  3. Create a public project in the group, called project01.

These three steps build the scene: an account, a group that will later get the IP restriction, and a project inside it that holds the files.

Step 2: Create the artifact files

In the project, create two files. The first is hidden.json:

JSON
{
   "hidden": "hidden"
}

This is a JSON file, a simple text format for structured data. It contains one entry, a name hidden with the value hidden. It stands in for any secret file a team might keep in a project.

The second is .gitlab-ci.yml:

YML
 data:
  artifacts:
    paths:
    - ./
    expire_in: 2 weeks

This is a YAML file, a text format that uses indentation to show structure. GitLab reads a file with this exact name to learn what to do when code changes. Line by line:

  • data: is the name of the job, so this job is called data.
  • artifacts: starts the section that says which files the job should keep as output.
  • paths: lists the files to keep.
  • - ./ means the whole project directory, so everything in the project is collected.
  • expire_in: 2 weeks says the kept files are thrown away after two weeks.

The job named data collects the whole project directory (./) as artifacts and keeps them for two weeks.

Step 3: Run the pipeline and browse the artifact

When the files are created, a pipeline job runs. Go to gitlab.com/group01/project01/-/pipelines, click the status done button, click the job data, and then click "browse" under job artifacts. At this point the artifact file can be clicked and downloaded. The URL looks like:

Text
https://gitlab.com/group01/project01/-/jobs/2493429745/artifacts/browse

Reading this address from left to right: https:// is the secure web protocol, gitlab.com is the site, group01/project01 is the group and project, -/jobs/2493429745 points at one job by its ID, and artifacts/browse asks for the list of files that job produced.

and the file is accessible like:

Text
https://gitlab.com/group01/project01/-/jobs/2493429745/artifacts/file/hidden.json

This is the same job address, but artifacts/file/hidden.json asks for one specific file inside the artifact instead of the list. Note the number 2493429745: that is the job ID, and it is the piece an outsider would need to know.

Step 4: Apply the IP allowlist

Go to the group settings at https://gitlab.com/groups/group01/-/edit and expand "Permissions and group features". Scroll down to "Allow access to the following IP addresses", enter [redacted] and press enter. As the owner you always have access to this settings page, so the entered address does not lock you out. Click save.

This step turns on the bouncer. The report enters [redacted] as the allowed address and notes that as owner you always have access to the settings page.

Step 5: Confirm the block on the normal paths

Go back to the artifact URL and the file URL. Both now return a 404 error: there is no access any more through the GitLab.com paths. This confirms the bouncer is working on the front door.

Step 6: Reach the same artifact through the pages domain

Change the ID in the following URL to the job ID from step 3:

Text
https://group01.gitlab.io/-/project01/-/jobs/2493429745/artifacts/hidden.json

Compare this with the earlier file URL. The site is now group01.gitlab.io instead of gitlab.com, and the group name has moved into the site name. Everything after it, -/project01/-/jobs/2493429745/artifacts/hidden.json, still names the project, the job and the file. This is the side door: a different domain that serves the same artifact.

The content of the artifact file is shown. Opening a new browser, or logging out and visiting the same site, still shows the artifact, so it is served unauthenticated. In other words, the bouncer is not standing at this door at all.

Root cause

The IP allowlist blocks artifact access on the GitLab.com application paths, but the pages domain that previews artifacts is not covered by the IP block. The preview feature is meant for rendering HTML artifacts, yet it exposes the complete artifact, so any file in the artifact, not just HTML, can be fetched. The pages endpoint is not restricted by the IP block, so the group owner's restriction does not apply there.

Knowing the job ID makes the attack harder to pull off, but job IDs leak through channels such as pipeline-finished email notifications, and the artifact is accessible to anyone who has the link. This kind of flaw, where a rule is enforced in one place but not in another that reaches the same data, is an access control problem: the system decides who may see something, and here that decision is skipped on one route.

Impact

Users can access pipeline job artifacts in groups that are restricted to specific IP addresses. When the protected project is Public, which the researcher says is a high risk for groups protected this way, the artifacts are leaked to unauthenticated users outside the IP range. The attack requires knowledge of the pipeline job ID, which can be obtained through leaks such as email notifications, and the report notes there might be other leak channels. The report was rated medium severity with a CVSS score of 5.9. CVSS is a standard scoring system that turns the seriousness of a flaw into a number, where higher means worse.

Fix

The report states the expected correct behaviour: the files should not be exposed. It does not describe a specific code change or a fix that was applied.

Variants to test

  • Other artifact-serving paths. Look for any other domain or route that serves job artifacts outside the main application, such as preview or rendering endpoints, and request a known artifact file through it while the group IP allowlist is active. A positive result is the file content being returned where the GitLab.com artifact URL returns 404.
  • Non-HTML artifact types. The preview feature is intended for HTML, so try other file types in the artifact (JSON, text, configuration files) through the pages path. A positive result is any non-HTML file being served in full.
  • Unauthenticated access. Repeat the request in a fresh browser or logged out. A positive result is the artifact being returned without a session. A session is the browser's proof that you logged in, usually kept in a small piece of data the site stores for you.
  • Job ID leak channels. Check pipeline-finished email notifications and other places where job IDs appear for an IP restricted project, then use a leaked ID against the pages path. A positive result is a working artifact URL built from an ID obtained outside the restricted network.
  • Other IP restricted resources. Apply the same reasoning to other features that serve project data from separate domains, checking whether the allowlist is enforced there. A positive result is restricted content being reachable from an address outside the allowlist.

Glossary

  • API: a way for programs to talk to a service and get data back, as opposed to web pages made for people to click.
  • Artifact: a file that an automated job produces and GitLab keeps for later download.
  • Authentication: proving who you are, usually by logging in. Unauthenticated means not logged in.
  • Access control: the rules that decide who is allowed to see or do what.
  • CVSS: a standard scoring system that gives a security flaw a number from low to critical.
  • Domain: the name part of a web address, such as gitlab.com or gitlab.io.
  • Endpoint: one specific address on a server that answers requests.
  • Group: a GitLab container that holds projects and people, often one per team or company.
  • HTML: the language web pages are written in.
  • IP address: the number that identifies a computer on a network.
  • IP allowlist: a list of IP addresses that are permitted, with everyone else blocked.
  • IP range: a block of IP addresses, for example all addresses used by one office.
  • Job: one automated task inside a pipeline.
  • Job ID: the number GitLab assigns to a job so it can be found again.
  • JSON: a simple text format for structured data.
  • Pipeline: a series of automated jobs GitLab runs for a project.
  • Premium / Ultimate: paid GitLab subscription plans; a trial is a free temporary version of a higher plan.
  • Project: a GitLab container for code and its pipelines.
  • Public: visible to anyone on the internet, logged in or not.
  • Session: the browser's proof that you logged in, kept as a small piece of data.
  • UI: the web pages you see and click in a browser.
  • URL: the address you type in the browser bar to reach a page or file.
  • Visibility: the setting that says who can see a project, such as public or private.
  • YAML: a text format that uses indentation to show structure, used for GitLab's pipeline configuration file.
  • 404: the standard web answer meaning there is nothing at that address.

More by joaxcar

View all

12 more disclosed reports, best first.

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.