Skip to content
Access control Disclosed report Beginner

Unauthenticated users can view Environment names from public projects limited to project members only

An unauthenticated user could access a JSON endpoint that listed environment names for a public project, even when the environments were configured to be visible only to project members. This exposed the names of environments that should have been restricted.

GitLab

Originally disclosed on GitLab

  • Fixed in 2 months
  • Disclosed after 2 months

HackerOne report #1817586 by ashish_r_padelkar on 2022-12-27, assigned to Ottilia Westerlund:

Overview

The following issue was reported by ashis_r_padelkar via HackerOne:

Hello,

I reported this similar issue before #1083430 but then it was a different permission model than now. Now there is a separate permissions that can be set specifically for Environments.

As per this https://docs.gitlab.com/ee/ci/environments/index.html, You must have at least the Reporter role. to view list of environments. However, it is possible for unauthenticated users to see the list of environment names even when environments are set to Only Project Members.

Steps to reproduce

  1. Create a public group as Group_1 and then public project underneath as Project_1.
  2. In Project_1, under Settings > General, set Environments to be visible for Only Project Members.
  3. Create few environments from the Environments page.
  4. If you browse as an unauthenticated user to the Environments page, you will get a not found error.
  5. Now browse to: /groups/Group_1/-/unfoldered_environment_names.json and you'll see a list of the environment names.

Examples

What is the current bug behavior?

Unauthenticated users can see a list of environment names despite they are set to be visible for Only Project Members.

What is the expected correct behavior?

Only project members should see the names of environments when set as Only Project Members.

Output of checks

This bug happens on GitLab.com – GitLab Enterprise Edition 15.8.0-pre 8831299643f.

Impact

Unauthenticated users can view environment names from public projects limited to project members only.

Proposal

Use a before_action to authorize a user can read environments for that particular action.

As an example, you could do something similar to EnvironmentsController:

Ruby
  before_action :authorize_read_environment!, only: [:unfoldered_environment_names]

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 controller action for the JSON endpoint lacked an authorization check to ensure the user has permission to read environments.

What the attacker needed

Public project; environments set to only project members; no authentication required

How it was found

  1. Create a public group and a public project under it.
  2. In the project settings, set Environments visibility to 'Only Project Members'.
  3. Create a few environments from the Environments page.
  4. As an unauthenticated user, browsing to the Environments page returns a not found error.
  5. Browse to the JSON endpoint for unfoldered environment names to see the list of environment names.

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, environments are used to track deployments. Normally, only project members with at least the Reporter role can see the list of environments. However, a special web address (URL) that returns data in JSON format did not check who was asking, so anyone could see the environment names.

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.