Skip to content
Access control Disclosed report Beginner

Maintainer can create a fork relationship between existing projects contrary to documentation

A maintainer of a project could create a fork relationship between that project and another project they control, even though the documentation states only project owners and administrators can do so. This allowed a maintainer to link projects in a way that contradicts intended permissions.

GitLab

Originally disclosed on GitLab

  • Fixed in 3 months
  • Disclosed after 3 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 #2058121 by theluci on 2023-07-08, assigned to @kmorrison1:

Report | Attachments | How To Reproduce

Report

Hello,

Background

Gitlab provides a feature to create a fork of a project.
When you create a fork of a project using UI, you become the owner of the forked project or downstream project. That is, only the owner of a project can create the fork relationship between the downstream project and upstream project.
Similarly, only the owner of a project can Remove fork relationship.

When using API as well, according to the docs, only the project owners and administrators can Create a fork relationship between existing projects as well as Delete an existing fork relationship.

7july-5.png
7july-5.png From the original on GitLab

Vulnerability

According to docs, only the project owners and administrators can Create a fork relationship between existing projects.

7july-6.png
7july-6.png From the original on GitLab

However, the above is not enforced and a Maintainer can create a fork relationship between existing projects.
This behaviour is contradictory to what happens when using UI as well as contradictory to what should happen according to docs.

Steps to reproduce

  1. victim creates a group victim-group and a project victim-project inside.
  2. victim goes to victim-project membership page, https://gitlab.com/<victim-group>/<victim-project>/-/project_members and adds attacker as maintainer.
  3. attacker creates a personal project attacker-project.
  4. attacker goes to his terminal and runs the following command,
curl --request POST --header "PRIVATE-TOKEN: <access_token>" "https://gitlab.com/api/v4/projects/<victim_project_ID>/fork/<attacker_project_ID>"  

attacker was able to create a fork relationship between victim-project and attacker-project contrary to documentation. (victim-project as the downstream project and attacker-project as the upstream project)

Please note that above attacker created a fork relationship between victim-project and attacker-project. However, it isn’t necessary, attacker can create a fork relationship between victim-project and any project attacker has access to, including public projects.

POC

8july-video2.mp4 From the original on GitLab

Output of checks

This bug happens on GitLab.com (Probably on instance too).

Impact

Maintainer can create a fork relationship between existing projects contrary to documentation

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

What the attacker needed

Attacker has maintainer role on victim project; attacker has access to another project

How it was found

  1. Victim creates a group and a project inside it.
  2. Victim adds the attacker as a maintainer to the project.
  3. Attacker creates a personal project.
  4. Attacker sends a POST request to the fork relationship API endpoint with the victim project ID and attacker project ID.

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 fork is a copy of a project that stays linked to the original. The documentation says only the project owner or an administrator can create that link between two existing projects. However, a user with the 'maintainer' role (a lower permission level) could still create the link using the API, which goes against the documented rules.

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.