Skip to content
Access control Disclosed report Intermediate

Auditor users can create merge requests on projects they don't have access to

An auditor user, who should only have read-only access to projects they are not a member of, could create merge requests in those projects by forking the project and opening a merge request from the fork. This allowed an auditor to write to projects they were only supposed to read.

GitLab

Originally disclosed on GitLab

  • Fixed in 5 months
  • Disclosed after 5 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 #2046752 by js_noob on 2023-07-02, assigned to @greg:

Report | Attachments | How To Reproduce

Report

Summary

Hello team, according to docs, an auditor has read-access to projects he doesn't have access to.

Have read-only access to projects you aren’t a member of.

However, an auditor can still create merge requests in projects he cannot access, using changes/branches originating from forks.

Steps to reproduce

As an admin:

  1. Spin up your own GitLab instance, and apply the ultimate trial to it (https://about.gitlab.com/free-trial/?hosted=self-managed)
  2. Create a private dummy project
  3. Create a new user in your instance (or you can easily signup from another browser)

As the other user:

  1. Verify that you can't access the project created in Step 2

As the admin:

  1. Promote that user to Auditor https://YOUR_DOMAIN/admin/users/USER_USERNAME/edit
image.png
image.png From the original on GitLab

As the auditor (previously the "other user"):

  1. Verify that you can "read" that project (created in step 2)
  2. Navigate to the merge requests page and verify that can't create MRs, now let's workaround that
  3. Fork that project into your namespace, create a new branch and add any changes to it
  4. Create a new MR with the base as your project with the new branch and target the original project with the main branch
image.png
image.png From the original on GitLab

As the admin:

  1. Verify that a new MR is created
Examples/POC
bandicam_2023-07-02_10-52-20-985.mp4 From the original on GitLab
What is the current bug behavior?

An auditor can create MRs, originating from forks, on projects he doesn't have access to.

What is the expected correct behavior?

Auditor MRs, originating from forks, on projects he doesn't have access to should be blocked just like any other MRs.

Results of GitLab environment info
System information  
System:         Debian 11  
Proxy:          no  
Current User:   git  
Using RVM:      no  
Ruby Version:   3.0.6p216  
Gem Version:    3.4.13  
Bundler Version:2.4.14  
Rake Version:   13.0.6  
Redis Version:  6.2.11  
Sidekiq Version:6.5.7  
Go Version:     unknown

GitLab information  
Version:        16.1.1-ee  
Revision:       d3582d7719f  
Directory:      /opt/gitlab/embedded/service/gitlab-rails  
DB Adapter:     PostgreSQL  
DB Version:     13.11  
URL:            https://gitlab-private.net  
HTTP Clone URL: https://gitlab-private.net/some-group/some-project.git  
SSH Clone URL:  [email protected]:some-group/some-project.git  
Elasticsearch:  no  
Geo:            no  
Using LDAP:     no  
Using Omniauth: yes  
Omniauth Providers: 

GitLab Shell  
Version:        14.23.0  
Repository storages:  
- default:      unix:/var/opt/gitlab/gitaly/gitaly.socket  
GitLab Shell path:              /opt/gitlab/embedded/service/gitlab-shell  

Impact

User with read-only access (auditor) can create merge requests on projects he doesn't have access to.

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 the permission check for creating merge requests from forks did not account for the auditor role's read-only restriction, allowing the action despite the lack of write access.

Impact

An auditor could create merge requests on projects they do not have access to, despite being restricted to read-only access.

What the attacker needed

GitLab instance with Ultimate trial; Auditor role assigned to attacker; Attacker can fork the target project

How it was found

  1. As an admin, create a private project and a new user.
  2. Verify the new user cannot access the private project.
  3. Promote the user to Auditor.
  4. As the auditor, verify read access to the project and that direct merge request creation is blocked.
  5. Fork the project, create a branch with changes, and open a merge request from the fork to the original project.
  6. As the admin, verify the merge request was created.

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.

The bug let an auditor bypass the read-only restriction by forking the project and opening a merge request from their fork back to the original project.

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.