Skip to content
Access control Disclosed report Intermediate CVE-2017-0919

GitHub import allows user to create child group under existing namespace

The GitHub import feature accepted a user-supplied target namespace and created a subgroup inside a group the user did not belong to. An attacker could gain owner-level access to that subgroup, see private group membership, use the parent group's plan, and create projects under a group they were not authorised to use.

jobert Follow

Originally disclosed on HackerOne

Bounty$750 High 7.1 View original
  • Triaged in 10 days
  • Fixed in 10 days
  • Paid in 10 days
  • Disclosed after 5 months

When importing a GitHub repository on GitLab, a request is made to /import/github. The user is allowed to pass along a target namespace where they want to add the repository. In this process, the code will create the namespace if it doesn't exist already. However, this can be used to create a sub-group of an existing group and give you "owner" level access to the sub-group. This has a couple benefits, including being able to use the plan of the owner group, see who is part of the group (helpful in case the group is private), and, perhaps most importantly, being able to create new projects under a group you're unauthorized to.

To reproduce, make sure there's a GitLab instance that has a group a user is unauthorized to create projects / groups for. Then, sign in to the normal user account and authorize GitLab to view your GitHub projects. Intercept your network traffic, then click the "Import" button. Observe a request similar to the one below being submitted:

Request

POST /import/github HTTP/1.1
Host: gitlab-instance
...

repo_id=115670444&target_namespace=jobertabma&new_name=test

In this request, change the target_namespace to secret-group/test. This will create a sub-group called test to the group secret-group.████ To exploit this, an attacker could set a GitLab logo as their group avatar and start spreading gitlab-ce and gitlab-ee projects under the gitlab-org namespace.

The sub-group as shown on the gitlab-org group page

Screen_Shot_2017-12-28_at_5.12.07_PM.png
Screen_Shot_2017-12-28_at_5.12.07_PM.png From the original on HackerOne

Automatic billing due to the relationship with gitlab-org

Screen_Shot_2017-12-28_at_5.11.46_PM.png
Screen_Shot_2017-12-28_at_5.11.46_PM.png From the original on HackerOne

This has been tested against the latest version of GitLab.

Impact

N/A

The original report as published on HackerOne, by jobert. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 import endpoint created the requested target namespace without checking that the user had permission to create subgroups in the parent group.

Impact

An attacker could create a subgroup under a group they do not belong to, gaining owner-level access there, viewing private membership, using the parent plan and creating projects under that group.

What the attacker needed

A GitLab account; GitHub account linked for import; a target group the user cannot access

How it was found

  1. Have a GitLab instance with a group the user is not allowed to create projects or groups in.
  2. Sign in as a normal user and authorise GitLab to view the user's GitHub projects.
  3. Intercept the traffic and click the Import button to capture the import request.
  4. Change the target namespace in the request to a subgroup path under the protected group.
  5. The subgroup is created inside the protected group with the user as owner.

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.

When you import a project from GitHub, GitLab asks which namespace (a folder-like place that holds projects and groups) the project should go into. The server trusted that name and made a new subgroup inside any group named, without checking whether the user was allowed to add anything there. That let a normal user slip into a private group's space and act as its owner.

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 by jobert

View all

67 more disclosed reports, best first.

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.