Skip to content
Access control Disclosed report Beginner

Create fork relation from public project which are not allowed to- API

A public project configured to disallow forking could still be forked via the API's create-fork-relation endpoint. An attacker could create a fork relationship and learn the project's fork count and default branch, which the UI hides.

GitLab

Originally disclosed on GitLab

  • Fixed in 20 months
  • Disclosed after 20 months

HackerOne report #419977 by ashish_r_padelkar on 2018-10-06:

Summary: Hello,

If a public project has following settings, gitlab users with no membership to the project are not allowed to create fork of the projects.

Screen_Shot_2018-10-06_at_15.13.51.png
Screen_Shot_2018-10-06_at_15.13.51.png From the original on GitLab

However, using below API endpoint, any body can create fork relationship from such projects https://docs.gitlab.com/ee/api/projects.html#create-a-forked-fromto-relation-between-existing-projects

POST /projects/:id/fork/:forked_from_id

Description: When projects has above settings , the users are not allowed to fork from such projects.

You can see my own public project here

[REDACTED]

You will not see button to fork. But if you have any other projects then you can create a fork relationship to that project from this project!!

Steps To Reproduce:

  1. Just run the following curl command
curl --request POST --header "PRIVATE-TOKEN: [REDACTED]" https://gitlab.com/api/v4/projects/<YourProjectID>/fork/<PublicProjectIDwithAboveSettings>
  1. This will show a fork relationship in your project of public project which should not be possible otherwise

Regards, Ashish

Impact

  1. This is not intended, so it can create inconsistencies across gitlab
  2. When creating fork relationship using above curl, response shows number of forks the public project has which isn't visible in UI
  3. It shows default Branch of the public project which isn't visible in UI if you have above mentioned settings

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

  • [REDACTED]

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 that creates a fork relationship did not enforce the project's forking-disabled setting, unlike the web interface.

Impact

The API could create inconsistencies and reveal the public project's fork count and default branch, which the UI hides when forking is disabled.

What the attacker needed

A GitLab account; a personal access token; a public project with forking disabled

How it was found

  1. Send a POST request to the fork-relation API endpoint for your project and the public project.
  2. Observe that a fork relationship is created even though the UI does not allow forking.

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.

GitLab lets you copy a public project into your own account, called forking. A project owner can turn forking off, but the report shows the API endpoint that creates a fork link did not check that setting. So someone with an account could still link a fork and see details like the fork count and default branch.

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.