Skip to content
Access control Disclosed report Beginner

Users can import members from projects that they are not a maintainer on through API

The API endpoint for importing project members did not enforce that the requester is a maintainer on the target project, unlike the UI. An attacker with maintainer access to one project could import members from any visible project, including private ones where they only had Guest access.

GitLab

Originally disclosed on GitLab

  • Fixed in 2 months
  • Disclosed after 2 months

HackerOne report #1356100 by joaxcar on 2021-10-01, assigned to GitLab Team:

Report | How To Reproduce

Report

Summary

Security patch 14.3.1 fixed (link to patch notes and link to commit) an issue where a maintainer in one project could import members from another project while not being a maintainer in that target project. This is now enforced in the GitLab UI and any requests putting the target project as a project where the user is not maintainer will fail.

This check is not enforced if the same user uses the API endpoint /projects/:id/import_project_members/:project_id documentation. As long as the user have maintainer access to the project with id :id the users can import members from any target :project_id as long as it is visible for the user. That is all public projects and any private project where the user have a role Guest or higher.

Steps to reproduce
  1. Create a two users user1 and user2

  2. Log in as user1 and create a public project project1 in the users namespace user1

  3. Make a note of the project ID, we call it ID1

  4. Log in as user2 and create a private project project2

  5. Make a note of the project ID, we call it ID2

  6. Go to https://gitlab.com/-/profile/personal_access_tokens and create an access token for user2, lets call it TOKEN1

  7. Send this request in a terminal (replacing <TOKEN>, <ID2> and <ID1>)

    curl --request POST --header "PRIVATE-TOKEN: <TOKEN1>" "https://gitlab.com/api/v4/projects/<ID2>/import_project_members/<ID1>"  
    
  8. Go to https://gitlab.com/user2/project2/-/project_members and verify that user1 is imported from the public project where user2 is not a member

Impact

Importing members is supposed to be an action that is restricted to users who are maintainers on both target projects. The API allows users to bypass this restriction.

What is the current bug behavior?

The API endpoint does not validate the role of the requester as the UI does

What is the expected correct behavior?

The API should work as the functionality in the UI

Output of checks

This bug happens on GitLab.com

Impact

Importing members is supposed to be an action that is restricted to users who are maintainers on both target projects. The API allows users to bypass this restriction.

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 API endpoint lacked the same authorization check that was added to the UI, allowing any maintainer of the source project to import members from any visible target project.

Impact

A user with maintainer access to one project could import members from any visible project, including private projects where they only had Guest access, bypassing the intended restriction.

What the attacker needed

Maintainer access to one project; personal access token; target project visible to attacker

The fix

The API should enforce the same maintainer check as the UI, requiring maintainer access on both projects.

How it was found

  1. Create two users, user1 and user2.
  2. Log in as user1 and create a public project project1.
  3. Note the project ID as ID1.
  4. Log in as user2 and create a private project project2.
  5. Note the project ID as ID2.
  6. Create a personal access token for user2.

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, importing members from another project should only be allowed if you are a maintainer on both projects. The web interface checked this, but the API did not, so someone could use the API to pull in members from projects they should not have access to.

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.