The content of the private project remains available after users are removed from the project members
A removed developer could still read private project content through a merge request they had created from the upstream project to their fork. After removal, the merge request continued to show all changes in the branch.
GitLab
Originally disclosed on GitLab
- Fixed in 44 days
- Disclosed after 44 days
HackerOne report #1162509 by 0xn3va on 2021-04-13, assigned to @vdesousa:
Report | Attachments | How To Reproduce
Report
Summary
Gitlab allows users with a developer role to create merge requests from an upstream project to a forked one. Users can use it for reading all changes in a particular branch, even an owner removes them from project members.
Steps to reproduce
-
Log in as an
user1 -
Create and initialize a private project
-
Add an
user2to the project with a developer role -
Log in as the
user2 -
Fork the project
-
Create a merge request from
user1:master(the upstream project) touser2:master(the forked project) with the following request:HTTP POST /<user1>/<private-project>/-/merge_requests HTTP/1.1 ... utf8=%E2%9C%93&authenticity_token=<token>&merge_request%5Btitle%5D=Title&merge_request%5Bsource_project_id%5D=<forked-project-id>&merge_request%5Bsource_branch%5D=<upstream-branch-name>&merge_request%5Btarget_project_id%5D=forked-project-id&merge_request%5Btarget_branch%5D=<forked-branch-name> -
Log in as the
user1and remove theuser2from members (set theAlso unassign this user from related issues and merge requestscheckbox)
Screenshot_2021-04-13_at_15.47.07.png From the original on GitLab -
Create a file in the upstream project
-
Log in as the
user2, go to the merge request; all changes are available
Impact
The content of the private project remains available after users are removed from the project members
What is the current bug behavior?
After the user is removed from the private project members, the content in a particular branch can be read via MR into the forked project.
What is the expected correct behavior?
Access to the content of the private project must be denied after removing the user from the members.
Results of GitLab environment info
$ gitlab-rake gitlab:env:info
System information
System: Ubuntu 20.04
Proxy: no
Current User: git
Using RVM: no
Ruby Version: 2.7.2p137
Gem Version: 3.1.4
Bundler Version:2.1.4
Rake Version: 13.0.3
Redis Version: 6.0.10
Git Version: 2.29.0
Sidekiq Version:5.2.9
Go Version: unknown
GitLab information
Version: 13.10.2-ee
Revision: cc4224220e6
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 12.6
URL: http://0xn3va.gitlab.local
HTTP Clone URL: http://0xn3va.gitlab.local/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
GitLab Shell
Version: 13.17.0
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Git: /opt/gitlab/embedded/bin/git
Impact
The contents of the private project remain available after users are removed from the project members
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
What the attacker needed
Attacker has a developer role in the private project; attacker can fork the project; attacker creates a merge request before removal
How it was found
- Log in as user1 and create a private project.
- Add user2 to the project with a developer role.
- Log in as user2 and fork the project.
- Create a merge request from the upstream project to the fork.
- Log in as user1 and remove user2 from members, also unassigning them from related issues and merge requests.
- Create a file in the upstream project, then log in as user2 and view the merge request to see all changes.
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 developer can fork a project and open a merge request to compare branches. Normally, removing someone from a private project should cut off all access. Here, the merge request kept working as a back door, letting the removed person see new code changes.
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.